开发者

I cant get UIScrollView and UIAccelerometer to play nice, even with threading

开发者 https://www.devze.com 2022-12-21 10:49 出处:网络
problem is, everytime i go into my application and scroll around inside the scrollview, everything else in the program is completely useless, and tills I stops me scrolling, the accelerometer, and not

problem is, everytime i go into my application and scroll around inside the scrollview, everything else in the program is completely useless, and tills I stops me scrolling, the accelerometer, and not to mention everything else wont do a thing, if anyone has any idea how i can get arou开发者_如何学Gond said problem, id be much obliged, yes I would. and i tried putting them on different threads in all sorts of ways, but that wasnt worth a thing. i dunno maybe I'd been doing it wrong is all. anyway any help would be much appreciated.


This sounds like the rest of your main application logic is running in a different run loop mode (probably NSRunLoopCommonModes) than the UIScrollView touch handling. If you're using any timers to control your logic, those will block until UI tracking has finished.

This fixed a problem that I had where none of my game logic was updating while the user was manipulating a scroll view. My fix was as simple as adding the following line when setting up a timer:

[[NSRunLoop currentRunLoop] addTimer:myTimer forMode:UITrackingRunLoopMode];

For more information, see this thread: NSTimer not firing when runloop is blocked.

0

精彩评论

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