简体   繁体   中英

UITapGestureRecognizer for UIView in Scroll View doesn't work

I have a uiView with added TapGestureRecognizer. This view is showed in scroll view. If the view is visible on the start, when ViewController with scroll view show, everythink is OK. Problem occurs when the view is not visible on start (when I need scroll ScrollView to see it) then TapGestureRecognizer doesn't call Tap action. Did you know how to resolve this problem?

As said by wain

The scroll view also has a gesture recogniser. By default, only 1 gesture recognizer can be handling touches at any one time. You need to make yourself the delegate of your gesture and then implement gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: to return YES . This will allow it to work at the same time as the scroll view.

For more detail check Apple's Document link

UIGestureRecognizerDelegate_Protocol

and you can also take reference as Example from below link.

Simultaneous gesture recognizers in Iphone SDK

I hope it will be helpful for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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