久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

ScrollView 手勢識別器吃掉所有的觸摸事件

ScrollView gesture recognizer eating all touch events(ScrollView 手勢識別器吃掉所有的觸摸事件)
本文介紹了ScrollView 手勢識別器吃掉所有的觸摸事件的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個 UIScrollView,我添加了一個點擊手勢識別器來顯示/隱藏一些 UI 覆蓋,使用:

I have a UIScrollView to which I added a single tap gesture recognizer to show/hide some UI overlay using:

UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
[scrollView addGestureRecognizer:singleTap];

和:

- (void)handleTap:(UITapGestureRecognizer *)sender {
    // report click to UI changer
}

我在 UIScrollView 的底部添加了一個簡易表格視圖.一切正常(水平和垂直滾動),但問題是點擊只能被手勢識別器識別(上圖),而不是簡單的表格視圖.如果我刪除注冊手勢偵聽器的行,一切正常,表格視圖會通知自己點擊.

I added an easy table view to the bottom of the UIScrollView. Everything works right (scrolling both horizontally and vertically) but the problem is that taps are recognized only by the gesture recognizer (above), but not by the easy table view. If I remove The line that registers the gesture listener, everything works fine, the table view notices taps on itself.

就好像手勢識別器函數(shù)吃掉"了表格視圖上的點擊事件,而不是向下傳播它們.

It's as if the gesture recognizer function "eats" the tap events on the table view and doesn't propagate them downward.

感謝任何幫助

推薦答案

這應該可以解決您的問題.
檢測 UIScrollView 上的觸摸事件 AND在 UIView 的組件上[放置在 UIScrollView 內(nèi)]
這個想法是告訴手勢識別器不要吞噬觸摸事件.為此,您需要將 singleTap 的 cancelsTouchesInView 屬性設置為 NO,默認為 YES.

This should solve your problem.
Detect touch event on UIScrollView AND on UIView's components [which is placed inside UIScrollView]
The idea is to tell the gesture recognizer to not swallow up the touch events. To do this you need to set singleTap's cancelsTouchesInView property to NO, which is YES by default.

UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
singleTap.cancelsTouchesInView = NO;
[scrollView addGestureRecognizer:singleTap]; 

這篇關(guān)于ScrollView 手勢識別器吃掉所有的觸摸事件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to subclass UIScrollView and make the delegate property private(如何繼承 UIScrollView 并使委托屬性私有)
Swift - how to get last taken 3 photos from photo library?(Swift - 如何從照片庫中獲取最后拍攝的 3 張照片?)
Setting contentOffset programmatically triggers scrollViewDidScroll(以編程方式設置 contentOffset 觸發(fā) scrollViewDidScroll)
Photos app-like gap between pages in UIScrollView with pagingEnabled(使用 pagingEnabled 的 UIScrollView 中頁面之間的照片應用程序式間隙)
why UIScrollView is leaving space from top in ios 6 and ios 7(為什么 UIScrollView 在 ios 6 和 ios 7 中從頂部留下空間)
UIScrollView pauses NSTimer while scrolling(UIScrollView 在滾動時暫停 NSTimer)
主站蜘蛛池模板: www.一区二区三区 | 国产乱码精品一区二区三区中文 | 日韩欧美亚洲 | 成人日批视频 | 黄视频在线网站 | 欧美精品一区二区三区四区 在线 | gogo肉体亚洲高清在线视 | 国产99久久久国产精品下药 | 日韩亚洲视频 | 超碰av免费 | 成人福利在线 | 中日韩毛片 | 2018天天干天天操 | 天天爽天天操 | 亚洲国产二区 | 久久精品国产亚洲 | 精品99久久久久久 | 亚洲欧美在线视频 | 色综合久久88色综合天天 | 精品国产乱码久久久久久丨区2区 | 一区中文字幕 | 日本中文字幕视频 | 久久久久久成人网 | 日韩av在线一区二区 | 天天色影视综合 | 国产精品a久久久久 | 国产精品欧美一区二区三区不卡 | 一a级片| 中文字幕在线三区 | 精品成人在线观看 | 亚洲综合色视频在线观看 | 日本久久久久久 | 久草热在线 | 色本道| 国产亚洲精品综合一区 | 日韩有码一区 | 一区二区三区视频在线免费观看 | 日韩在线视频一区 | 国产精品精品视频一区二区三区 | 精精国产xxxx视频在线播放 | 成人九区|