How to get active subview (UIImageView) from UIScrollView
I have several UIImage subviews in one UIScrollView. I'm trying to emulate iPhones's Photos app. To enable pinch zooming, I have implemented UIScrollViewDelegate and the one thing I'm unable to figure out is this delegate function:
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView;
How do I find out which UI开发者_如何学PythonImage subview is currently active?
Something like:
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{ return activeUIImageViewSubView; }
You probably want to keep track yourself of the current UIImage subview.
Or if you have only one visible at a time, look for the one with the coordinate values that make it visible.
If you want to zoom them all at the same time, you may want to group all your UIImage in an intermediate UIView that could be scrolled and panned.
精彩评论