开发者

How to get active subview (UIImageView) from UIScrollView

开发者 https://www.devze.com 2022-12-25 17:03 出处:网络
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 fig

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号