简体   繁体   English

将Pinch / Zoom效果添加到UIScrollView内的UIImageView

[英]Adding Pinch/Zoom effect to a UIImageView inside a UIScrollView

I have a very basic screen sharing iPhone app, I have successfully added the pinch/zoom effect to my app using a UIImageView inside a UIScrollView . 我有一个非常基本的屏幕共享iPhone应用程序,我已成功使用UIScrollView内的UIImageView将捏/缩放效果添加到我的应用程序。

The UIImageView receives the screen content from the PC on a regular interval. UIImageView定期从PC接收屏幕内容。 Everything works fine but as soon as I scroll/pinch/zoom it works at first but then it stops, and the delegate method that's updating the image view content stops firing up even though the server still sends the screen content. 一切正常,但是一旦我滚动/捏合/缩放它首先工作但它停止,并且即使服务器仍然发送屏幕内容,更新图像视图内容的委托方法也会停止启动。 The whole app seems to be frozen but there are no error messages/exceptions/whatever. 整个应用程序似乎被冻结,但没有错误消息/异常/无论如何。 Can anyone help me, please? 有人可以帮帮我吗?

If you are using NSDefaultRunLoopMode , UIAPPlication adds a run loop mode UITrackingRunLoopMode for tracking scrollview events like scrolling. 如果您使用的是NSDefaultRunLoopModeUIAPPlication会添加一个运行循环模式UITrackingRunLoopMode用于跟踪滚动查看滚动视图事件。 Since the UIApplication switches from NSDefaultRunLoopMode to UITrackingRunLoopMode any events on NSDefaultRunLoopMode will not be called until UIAPPlication switch back to NSDefaultRunLoopMode . 由于UIApplication从交换机NSDefaultRunLoopModeUITrackingRunLoopMode对任何事件NSDefaultRunLoopMode不会被调用,直到UIAPPlication切换回NSDefaultRunLoopMode

It might be the problem, the fix is change NSDefaultRunLoopMode to NSRunLoopCommonModes . 可能是问题,修复是将NSDefaultRunLoopMode更改为NSRunLoopCommonModes

If you are not sure whether you are using runloop or not as you mentioned in comment. 如果您不确定是否正在使用runloop,就像您在评论中提到的那样。 Just search NSDefaultRunLoopMode in your project. 只需在项目中搜索NSDefaultRunLoopMode

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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