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

取消當前 UIScrollView 觸摸

Cancel current UIScrollView touch(取消當前 UIScrollView 觸摸)
本文介紹了取消當前 UIScrollView 觸摸的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個帶有幾個子視圖的 UIScrollView 等等.我也是scrollView的delegate,并實現了- (void)scrollViewDidScroll:(UIScrollView *)scrollView.在我的卷軸下面有另一個視圖.

I have an UIScrollView with a few subviews and so on. I am also the scrollView's delegate and have implemented the - (void)scrollViewDidScroll:(UIScrollView *)scrollView. Underneath my scroll there is another view.

如果滾動視圖的 contentOffset 在 x 軸上低于 50px,我想顯示該視圖,重置"滾動視圖的 contentOffset 并取消當前的滾動視圖手勢,以便用戶不會在新視圖出現時操作其內容.

I want to show that view if the scrollView's contentOffset goes under 50px on x axis, "reset" scrollView's contentOffset and cancel the current scrollView gesture so that the user wont manipulate its content when the new view appears.

我已經實現了這樣的方法:

I have implemented the method like so:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    if (scrollView.contentOffset.x < -50)
    {
        scrollView.contentOffset = CGPointZero;
        [self showBackView];
        //here I want to cancel the current touch on the scrollview since it keeps scrolling if I drag my finger
    }
}

我曾嘗試將 userInteractionEnabled 屬性設置為 NO 但只有在觸摸結束后才會生效.而且我嘗試了許多其他屬性,但似乎都沒有.

I have tried to set the userInteractionEnabled property to NO but it takes effect only after the touch has ended. And I have tried a bunch of other properties but none seems to work.

我該如何解決這個問題?

How can I fix this?

推薦答案

嘗試禁用滾動視圖的 panGestureRecognizer(然后重新啟用它).這將取消識別器的當前會話:

Try disabling the panGestureRecognizer for the scroll view (and then reenabling it). This will cancel the current session of the recogniser:

self.scrollView.panGestureRecognizer.enabled = NO;
self.scrollView.panGestureRecognizer.enabled = YES;

斯威夫特

self.scrollView.panGestureRecognizer.isEnabled = false
self.scrollView.panGestureRecognizer.isEnabled = true

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

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

相關文檔推薦

how to set scrollview content size in swift 3.0(如何在 swift 3.0 中設置滾動視圖內容大小)
Stop a UITableView from automatically scrolling(阻止 UITableView 自動滾動)
iOS UIScrollView Lazy Loading(iOS UIScrollView 延遲加載)
using iOS 6.0 SDK and building for iOS 5 Target causes UIScrollView setMinimumZoomScale to fail when running on iOS 5 simulator(在 iOS 5 模擬器上運行時,使用 iOS 6.0 SDK 并為 iOS 5 Target 構建會導致 UIScrollView setMinimumZ
Create partial-screen UIPageViewController programmatically(以編程方式創建部分屏幕 UIPageViewController)
how to make an ImageView zoomable with or without ScrollView.?(如何使用或不使用 ScrollView 使 ImageView 可縮放?)
主站蜘蛛池模板: 中文在线视频 | 国产一区二区免费电影 | 日韩一区中文字幕 | 色天天综合 | 国产精品美女久久久久aⅴ国产馆 | 久久久久综合 | 精产国产伦理一二三区 | 99国产精品99久久久久久 | 国产一区二区三区精品久久久 | 国产一区二区在线播放视频 | 国产色在线| 久久综合影院 | 一区中文字幕 | 中文字幕在线网 | 国产亚洲精品久久久久动 | 午夜影院免费体验区 | 精品日韩一区二区 | www.亚洲视频 | 亚洲精品乱码久久久久久久久久 | 97国产精品视频人人做人人爱 | 亚洲一区二区视频在线观看 | 日韩电影中文字幕 | 精品国产欧美一区二区 | 久久久久午夜 | 三极网站| 日韩在线一区二区三区 | 国产精品欧美一区二区三区 | 亚洲一二三在线 | 天天玩天天操天天干 | 国产情侣啪啪 | 中文字幕第7页 | 一区二区三区亚洲 | 三级成人在线观看 | 久久国产日本 | 中文字幕11页 | 看a级黄色毛片 | 欧美一区二区三区在线视频 | 国产精品久久久久久亚洲调教 | 欧美亚洲免费 | 免费在线一区二区 | 特黄色一级毛片 |