After pulling the latest from gmoledina/GMGridView I added a few small features that I needed to complete the picture for invi. I think they can be useful in a broader scope.
Please note that the list of commits (12) looks scarry, but most of them are just leftovers from previously non-pulled commits. There are only two interesting commits,
Add pagingEnabled to the grid. It simply delegates the property back …
…to the undelying scrollView
Fix name of isPagingEnabled to pagingEnabled. Old java habits...
Implement GMGridViewLayoutHorizontalPagedLtr. a layout for paged hori…
…zontal scroll where items in each page flow from top-left to bottom-right
Add convertScrolledPoint and convertScrolledRect so users of GMGridVi…
…ew are able to get the position of a scrolled element
Add 'build' to gitignore
Add support for better programatic scroll control.
Expose the contentOffset
Allow scrolling to a particular point (and not only to a particular item)
Add more page queries to the GMGridViewLayoutHorizontalPagedLtrStrategy
... it's all part of the same scheme...
Add GMGridViewDidScroll so that users know when GMScrollView is scrol…
Looks good ! I'll check it tomorrow and merge it.
Add support for setting showsVerticalScrollIndicator and showsHorizon…
Scrolling to a particular point will be weird when paging is enabled
OK, this commit has two different things even though in my mind they are related.
We have the two geometry methods:
They are useful to know the physical location on the screen a certain item in a page (I use it to 'fly' things away from the grid off to another UIView in an animation when the user touches them)
The second thing is
Well, I have a paging control that I use to scroll b/w pages. So I use a combination of originForPage and setContentOffset.
I see why this breaks encapsulation and I'm open for suggestions... the goal is to allow an external page control to slide switch pages in the grid.
As a matter of fact when I come to think of it, regarding setContentOffset and pagingEnabled - this is consistent with how UIScrollView behaves. Event in UIScrollView it's possible to programmatically scroll to any point in the scroll view even though the scroll view is paged. So although I agree with you that this is breaking encapsulation to some degree, at least we didn't break it first and we're consistent with apple model ;)
I'll add this on my next update when I'll add an API to allow having a pageControl (so knowing when the page changed).
Is it better to have just one property that controls both horizontal and vertical scroll indicator ?
As we never have both of them visible at the same time anyway.
Alright! I've pulled your code on my local repo. It will be part of the next release.
Add build directory to .gitignore
1. Add support for optional GMGridViewActionDelegate selector GMGridV…
2. Add Geometry selectors convertScrolledPoint:toView: and convertScrolledRect:rect toView:
Add to GMGridViewLayoutHorizontalPagedStrategy the selector pageForCo…
Merge with rantav/master
Use algebra to calculate _numberOfItemsPerColumn, instead of a while …
Compute _numberOfItemsPerRow with algebra instead of a while loop.