久久久久久久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 可縮放?)
主站蜘蛛池模板: 色五月激情五月 | 色网站入口 | 日韩av在线免费 | 久久美女网 | 日本手机在线 | 看片地址 | www.com久久久| 久久这里只有精品首页 | 欧美三级电影在线播放 | 亚洲视频 欧美视频 | 国产高清一二三区 | 欧美成人手机视频 | 国产精品久久久久无码av | 亚洲国产成人精品女人久久久 | 蜜桃日韩| 91 在线| 成人在线精品 | 日韩av中文| 午夜影院黄 | 日日干天天操 | 日韩精品一区二区三区中文在线 | 男人的天堂在线视频 | 成人av一区二区亚洲精 | 国产婷婷色综合av蜜臀av | 亚洲有码转帖 | 欧美黄色片 | 国产精品国产三级国产aⅴ无密码 | 精品无码久久久久久国产 | 91在线电影 | 成年人在线 | 中文字幕一区二区三区日韩精品 | 久久精彩 | 国产高清视频 | 国产最新视频在线 | 91视频网址| 香蕉视频91 | 亚洲精品欧美 | 成人av播放 | 国产精品天堂 | 免费在线观看毛片 | 99视频 |