Reputation: 29886
How is the current offset for a Scrollview accessed?
I know the following
[someScrollView contentOffset]
but does this return the current offset and if so how can this be casted to an integer?
I want to use this integer/image size to get the current image being viewed. OR is there better way to get the current image being displayed in the scrollview.
By the tag somehow?
Upvotes: 0
Views: 2009
Reputation: 94794
A UIScrollView can scroll in both the horizontal and vertical directions. contentOffset
returns a CGPoint struct that has x and y fields (which are both floats) to give you the offset in both dimensions.
To figure out which image is being viewed, you'd have to cross-reference the offset in the appropriate dimension(s) with the position of each image within the scroll view's content. The tag has nothing to do with it.
Upvotes: 1