UIScrollView:在scrollViewDidEndZooming中重新创建内容视图
我想问一下,在 scrollViewDidEndZooming
方法中重新创建内容视图是否正确?这有什么潜在的问题吗?我使用以下代码:
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale {
[self.contentView removeFromSuperview];
self.contentView = [[ContentView alloc] init ...];
...
[scrollView addSubview:self.contentView];
}
并且在模拟器中一切正常,但是当我在设备上运行此示例时,有时当我用捏合手势缩放时,我将 scale
值设置为 1.0,这非常奇怪,因为实际上应将其设置为不同于 1.0 的缩放比例。另外,有人可以建议我应该在 removeFromSubview
调用后添加 self.contentView = nil
吗?
注意:我使用 SDK 3.1.2
提前谢谢您
I would like to ask, is it correct to recreate content view in scrollViewDidEndZooming
method? Is there any potential problems with this? I use the following code:
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale {
[self.contentView removeFromSuperview];
self.contentView = [[ContentView alloc] init ...];
...
[scrollView addSubview:self.contentView];
}
and with the simulator everything works correctly, but when I run this example on device sometimes when I zoom with pinch gesture I have a scale
value set to 1.0 that is very strange because actually it should be set to zoom scale that differ from 1.0. Also, could somebody advice should I add self.contentView = nil
after removeFromSubview
call?
NOTE: I use SDK 3.1.2
Thank you in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论