In my scroll view, I want to get the current page that's being displayed (maybe page isn't the correct term). I can't find any variable that holds this. But I think it must be held somewhere, since the indicator is able to show which sub-view of the scroll view is currently being displayed.
Is this hidden from us completely or is there a way for me to access it?
Just divide the current offset by the page size:
Are you using a UIPageControl? If so, this has a
currentPage
property. If not, I think you'll need to calculate the page index from the scrollView offset.Another way:
In xCode 7.x swift 2.x you can do :
In swift I would do it in extension:
Then just call:
If Any one Looking for way of doing in C# for Xamarin
This getter and Setter should provide you current page as well let you scroll to the specified page