Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

The UIImageView receives the screen content from the PC on a regular interval. 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?

like image 205
Nasreddine Avatar asked Nov 18 '25 23:11

Nasreddine


1 Answers

If you are using NSDefaultRunLoopMode, UIAPPlication adds a run loop mode UITrackingRunLoopMode for tracking scrollview events like scrolling. Since the UIApplication switches from NSDefaultRunLoopMode to UITrackingRunLoopMode any events on NSDefaultRunLoopMode will not be called until UIAPPlication switch back to NSDefaultRunLoopMode.

It might be the problem, the fix is change NSDefaultRunLoopMode to NSRunLoopCommonModes .

If you are not sure whether you are using runloop or not as you mentioned in comment. Just search NSDefaultRunLoopMode in your project.

like image 192
Chandan Shetty SP Avatar answered Nov 21 '25 13:11

Chandan Shetty SP