开发者

Zoom and marker

开发者 https://www.devze.com 2023-03-06 20:29 出处:网络
I have UIScrollView with UIImageView on it. On UIImageView I have round marker(one more UIImageView), which I can drag on UIImageView. I want to zoom my image on UIImageView, so:

I have UIScrollView with UIImageView on it. On UIImageView I have round marker(one more UIImageView), which I can drag on UIImageView. I want to zoom my image on UIImageView, so:

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
    return imageV开发者_Python百科iew;
}

But when user is trying to zoom image my marker is zooming too. But I want to see my marker in its original size. How can I do it?


You can apply reverse zooming transform to your marker in delegate's method:

- (void) scrollViewDidEndZooming: (UIScrollView *) aScrollView withView: (UIView *) view atScale: (float) scale{
    marker.transform = CGAffineTransformMakeScale(1.0f/scale, 1.0f/scale);
}

Or in scrollViewDidZoom: method - depending on which one will give better behaviour for you

0

精彩评论

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