久久久久久久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)
主站蜘蛛池模板: 国产精品高清在线 | 毛片网在线观看 | 日韩精品在线播放 | 国产专区视频 | 9porny九色视频自拍 | 午夜影院黄 | www.操com| 欧美日韩在线免费观看 | 精品成人av| 精品二三区 | 欧美日韩精品亚洲 | 男女羞羞在线观看 | 亚洲逼院 | 91精品在线看 | 男女视频在线免费观看 | 国产一区二区三区高清 | 欧美精品v | 高清视频一区二区三区 | 91porn在线| 欧美精品片| 天天躁日日躁性色aⅴ电影 免费在线观看成年人视频 国产欧美精品 | 日韩欧美国产精品一区二区 | 国产欧美精品区一区二区三区 | 91精品久久久久 | 亚洲一二三视频 | 91久久精品一区二区二区 | 亚洲欧美日韩精品久久亚洲区 | 国产成人精品一区 | 狠狠入ady亚洲精品经典电影 | 日本一卡精品视频免费 | 国产成人免费视频网站高清观看视频 | 国产三区av | 日韩在线精品视频 | 99re在线视频| 国产精品国产精品国产专区不片 | 日韩激情视频一区 | 国产精品一区二区av | 日韩精品av| 人人人人人爽 | 免费久久久久久 | 国产一区999 |