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

UIScrollView 中的 UIButton 觸摸延遲

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

問(wèn)題描述

我的應(yīng)用遇到了一個(gè)小問(wèn)題.

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

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

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.

我假設(shè)這是因?yàn)?UIScrollView 需要確定觸摸是滾動(dòng)還是用于子視圖的觸摸.

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.

無(wú)論如何,我有點(diǎn)不確定如何進(jìn)行.我只是希望按鈕在我點(diǎn)擊后立即顯示為選中狀態(tài).

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 設(shè)置為 NO,但滾動(dòng)幾乎變得不可能,因?yàn)槲业拇蟛糠?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.

推薦答案

好的,我已經(jīng)通過(guò)繼承 UIScrollView 并覆蓋 touchesShouldCancelInContentView

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

現(xiàn)在我的 UIButton 被正確標(biāo)記為 99 高亮并且我的滾動(dòng)視圖正在滾動(dòng)!

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;
    }

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

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(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 - 如何從照片庫(kù)中獲取最后拍攝的 3 張照片?)
Setting contentOffset programmatically triggers scrollViewDidScroll(以編程方式設(shè)置 contentOffset 觸發(fā) scrollViewDidScroll)
Photos app-like gap between pages in UIScrollView with pagingEnabled(使用 pagingEnabled 的 UIScrollView 中頁(yè)面之間的照片應(yīng)用程序式間隙)
why UIScrollView is leaving space from top in ios 6 and ios 7(為什么 UIScrollView 在 ios 6 和 ios 7 中從頂部留下空間)
UIScrollView pauses NSTimer while scrolling(UIScrollView 在滾動(dòng)時(shí)暫停 NSTimer)
主站蜘蛛池模板: 国产精品视频一二三区 | 亚洲九色| 精久久久久 | 国产精品永久免费 | 亚洲国产精品va在线看黑人 | 国产精品久久免费观看 | 久久久www成人免费无遮挡大片 | 免费九九视频 | 久久亚洲一区二区 | 国产在线网站 | 国产精品区二区三区日本 | 久久艹免费视频 | 毛片免费观看视频 | 理论片午午伦夜理片影院 | 日韩精品一区二区三区老鸭窝 | 欧美成人a | 天天拍天天插 | 国产精品美女久久久久久久网站 | 精品国产一区二区三区成人影院 | 日日摸日日碰夜夜爽2015电影 | 成人高清在线视频 | 亚洲国产成人精品久久久国产成人一区 | 欧美日韩综合视频 | 一区二区精品视频 | 国产精品久久久久久久久免费桃花 | 天天射色综合 | 欧美色成人 | 欧美成年人网站 | 精品欧美二区 | 黄色a视频 | 天堂中文资源在线 | h片在线看 | 亚洲一级黄色 | 欧美精品一区二区三区在线四季 | 欧美色综合一区二区三区 | 久久香焦| 久久国产成人 | 国产男女视频网站 | 成人免费淫片aa视频免费 | 欧美中文字幕一区二区三区 | 在线观看免费av网站 |