UISwipeGestureRecognizer not firing

那年仲夏 提交于 2019-12-10 22:28:04

问题


I have a UISwipeGestureRecognizer setup in IB linked to my view like so:

Extremely trivial, done it a million times. However this time it never fires >:|

Here is my method that should be called when a user swipes.

However this never gets called.

  • No it's not accidentally added to a subview
  • Yes the Pan gesture works perfectly.

I have another view setup almost exactly the same as this that works fine. Any ideas?


回答1:


Try this delegate Method in your ViewController

Returning YES is guaranteed to allow simultaneous recognition and returning NO is not guaranteed to prevent simultaneous recognition, as the other gesture's delegate may return YES

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

  return YES;

}


来源:https://stackoverflow.com/questions/13598505/uiswipegesturerecognizer-not-firing

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