ios recognizing gestures simultaneously with object handling

自作多情 提交于 2019-12-12 03:08:50

问题


Is it possible to recognize gestures and touches simultaneously when interacting with a UIKit object. For example, when a user is scrolling through a slider or pickerview, could I also be handling a swipe gesture?


回答1:


If you set your view controller to be the delegate of your gestures, you can implement:

- (BOOL) gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer

I'm not sure if you're also trying to have the view handle touch events separately, but if you are, I'd recommend subclassing UIGestureRecognizer and handle touch events there.




回答2:


Use NSThread or NSTimer to create a new thread where you can create another process which will run parallel to main thread of the application



来源:https://stackoverflow.com/questions/8855145/ios-recognizing-gestures-simultaneously-with-object-handling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!