gpt4 book ai didi

iphone - UIScrollView可以zoomToRect吗?

转载 作者:行者123 更新时间:2023-12-01 17:10:20 34 4
gpt4 key购买 nike

有没有一种方法可以确定UIScrollView是否可以在zoomToRect:maximumZoomScale中使用minimumZoomScale?因此,如果所需的zoomScale太小,则返回NO?

最佳答案

也许这种事情可能起作用? (从https://stackoverflow.com/a/2125472/845115偷来的想法)

- (BOOL)scrollView:(UIScrollView*)scrollView canZoomToRect:(CGRect)zoomToRect {
CGPoint contentOffsetBefore = scrollView.contentOffset;
CGFloat zoomBefore = scrollView.zoomScale;
[scrollView zoomToRect:zoomToRect animated:NO];
CGFloat zoomAfter = scrollView.zoomScale;

[scrollView setZoomScale:zoomBefore animated:NO];
[scrollView setContentOffset:contentOffsetBefore animated:NO];

return (zoomBefore == zoomAfter);
}

关于iphone - UIScrollView可以zoomToRect吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8878334/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com