![](/img/trans.png)
[英]Tap gesture on multiple imageview inside scrollview not firing event , only first imageview tap gesture working?
[英]Tap working only at the end of the scroll movement in ScrollView
我的項目涉及iPhone的Xcode IOS 10+,語言是ObjectiveC。
我創建了一個包括內容視圖的ScrollView。 在內容視圖中,有一個與TapGestureRecognizer關聯的UIImageView。 所有這些都是通過StoryBoard進行可視化制作的。
只要滾動運動結束,TapGestureRecognizers都可以工作。 否則,如果用戶滾動,則無法點擊。
已啟用UserInterraction標志,Delays Content Touches標志已設置為false。 但是它沒有用。
你們中的任何人都會遇到類似的問題,您將如何解決?
我認為滾動視圖在滾動時會消耗點擊手勢,因為它用於停止滾動運動。 嘗試在您的UITapGestureRecognizer上設置委托,並響應委托方法shouldRecognizeSimultaneouslyWithGestureRecognizer。
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
// Possibly check for your two gesture recognizer here
return YES;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.