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

UIScrollView 中的 UIButton 觸摸延遲

UIButton touch is delayed when in UIScrollView(UIScrollView 中的 UIButton 觸摸延遲)
本文介紹了UIScrollView 中的 UIButton 觸摸延遲的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我的應用遇到了一個小問題.

I'm running into a small issue in my app.

我本質上在 UIScrollView 中添加了一系列 UIButtons 作為子視圖,該 UIScrollView 是 nib 的一部分.每次我點擊一個按鈕時,在按鈕被突出顯示之前都會有一個明顯的延遲.在按鈕變暗并顯示為選中之前,我基本上必須按住它大約半秒鐘.

I essentially have a series of UIButtons added as subviews in a UIScrollView which is part of a nib. Every time I tap on a button there is a noticeable delay before the button is highlighted. I essentially have to hold it for about half a second before the button dims and appears selected.

我假設這是因為 UIScrollView 需要確定觸摸是滾動還是用于子視圖的觸摸.

I'm assuming this is because the UIScrollView needs to determine if the touch is a scroll or if it's a touch that is meant for a subview.

無論如何,我有點不確定如何進行.我只是希望按鈕在我點擊后立即顯示為選中狀態.

Anyways, I'm a little unsure on how to proceed. I simply want the button to appear selected as soon as I tap it.

感謝任何幫助!

我嘗試將 delaysContentTouches 設置為 NO,但滾動幾乎變得不可能,因為我的大部分 scrollView 都充滿了 UIButtons.p>

I've tried setting delaysContentTouches to NO but scrolling becomes almost impossible since a majority of my scrollView is filled with UIButtons.

推薦答案

好的,我已經通過繼承 UIScrollView 并覆蓋 touchesShouldCancelInContentView

Ok I've solved this by subclassing UIScrollView and overriding touchesShouldCancelInContentView

現在我的 UIButton 被正確標記為 99 高亮并且我的滾動視圖正在滾動!

Now my UIButton that was tagged as 99 highlights properly and my scrollview is scrolling!

myCustomScrollView.h:

@interface myCustomScrollView : UIScrollView  {

}

@end

myCustomScrollView.m:

@implementation myCustomScrollView

    - (BOOL)touchesShouldCancelInContentView:(UIView *)view
    {
        NSLog(@"touchesShouldCancelInContentView");

        if (view.tag == 99)
            return NO;
        else 
            return YES;
    }

這篇關于UIScrollView 中的 UIButton 觸摸延遲的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

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 觸發 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)
主站蜘蛛池模板: 欧美成人久久 | 免费人成激情视频在线观看冫 | 在线精品亚洲欧美日韩国产 | 91精品综合久久久久久五月天 | 久久在线精品 | av黄色网 | 日本午夜在线视频 | 国产一区二区三区免费观看在线 | 久久精品免费 | 九九色综合| 国产黄色精品在线观看 | 成人欧美一区二区三区黑人孕妇 | 欧美日韩亚洲系列 | 在线免费激情视频 | 久久亚洲91| 国产伦精品一区二区三区照片91 | 中文字幕高清免费日韩视频在线 | 欧美精品日韩精品国产精品 | 国产伦一区二区三区四区 | 国产欧美一区二区三区另类精品 | 久久久久久免费精品一区二区三区 | 久久久久久久综合 | 九九久久国产 | 精品免费在线 | 91亚洲欧美| jlzzjlzz国产精品久久 | 欧美成年网站 | 欧美一级黄色片免费观看 | 成人一区在线观看 | 在线视频久久 | 欧美日韩不卡合集视频 | 日本久久福利 | 综合久久综合久久 | 欧美a∨ | 日韩电影一区 | 婷婷丁香在线视频 | 日韩黄色小视频 | av免费观看网站 | 欧美视频在线播放 | 久久久视频在线 | 色影视|