Consider a UICollectionView
with flow layout and paging enabled (by setting pagingEnabled
to YES
).
What would be the simplest way of obtaining the total number of pages?
And where would be the most appropriate place to update the total number of pages (given that it might change if items are added/deleted, the size of the collection view changes or the layout changes)?
If the
UICollectionView
scrolls horizontally, you divide itscontentSize
's width to its frame's width:If it scrolls vertically, you divide its
contentSize
's height to its frame's height:The right answer should be:
follow to wiki:
Here is my result to check: