简体   繁体   中英

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 UIImage 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM