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

以編程方式強制 UIScrollView 停止?jié)L動,以便與多個

Programmatically force a UIScrollView to stop scrolling, for sharing a table view with multiple data sources(以編程方式強制 UIScrollView 停止?jié)L動,以便與多個數據源共享表格視圖) - IT屋-程序員軟件開發(fā)技術分享
本文介紹了以編程方式強制 UIScrollView 停止?jié)L動,以便與多個數據源共享表格視圖的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個 UITableView,當用戶觸摸分段控件時,它的數據源和委托在幾個自定義數據源對象之間切換(想想應用商店應用中的Top Paid"與Top Free").

I have a UITableView whose data source and delegate are switched between a couple of custom data source objects when the user touches a segmented control (think "Top Paid" vs "Top Free" in the app store app).

每個數據源對象保存它的最后滾動內容偏移量,并在它成為表格視圖的活動數據源時恢復它,方法是:

Each data source object saves its last scroll content offset, and restores it when it becomes the active data source for the table view by doing:

tableView.contentOffset = CGPointMake(0, savedScrollPosition);

這在用戶在表格靜止時切換數據源時效果很好,但是如果用戶在表格仍在移動(即減速)時點擊分段控件,表格視圖會繼續(xù)從舊的偏移量開始減速,有效地覆蓋我的 contentOffset 分配.

This works well when the user switches the data source when the table is at rest, but if the user hits the segmented control while the table is still moving (i.e. decelerating), the table view continues to decelerate from the old offset, effectively overriding my contentOffset assignment.

有沒有辦法在我設置 contentOffset 時強制表格視圖停止?jié)L動/減速,或者有其他方法使這種類型的可切換數據源表格視圖工作?

Is there a way to force the table view to stop scrolling/decelerating when I set the contentOffset, or another way to make this type of switchable-data-source table view work?

推薦答案

這2個方法你試過了嗎?

Did you try these 2 methods?

它們實際上適用于滾動",而不僅僅是內容的偏移量.

They actually apply to the "scrolling" not just the offset of the content.

[self.tableView  scrollToRowAtIndexPath:savedIndexPath atScrollPosition:UITableViewScrollPositionTop animated:NO];

或者:

[self.tableView  scrollRectToVisible:savedFrame animated:NO];

它們實際上應該影響滾動并通過擴展來加速表格,而不僅僅是屏幕上可見的內容.

They should actually effect the scrolling and by extension the acceleration of the table, not just what is visible on screen.

這篇關于以編程方式強制 UIScrollView 停止?jié)L動,以便與多個數據源共享表格視圖的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Clean autorotation transitions in a paging UIScrollView(清除分頁 UIScrollView 中的自動旋轉轉換)
How to create an image from a UIView / UIScrollView(如何從 UIView/UIScrollView 創(chuàng)建圖像)
How to auto scroll UIScrollView using timer?(如何使用計時器自動滾動 UIScrollView?)
What does contentOffset do in a UIScrollView?(UIScrollView 中的 contentOffset 有什么作用?)
How to implement UIScrollView with 1000+ subviews?(如何實現具有 1000 多個子視圖的 UIScrollView?)
Adding a header view to a UIWebView similar to Safari and Articles(將標題視圖添加到類似于 Safari 和文章的 UIWebView)
主站蜘蛛池模板: 日韩精品成人 | 日韩精品视频在线 | 精品视频在线免费 | 国产一级一片免费播放放a 男男成人高潮片免费网站 精品视频在线观看 | 一级黄色片免费 | 亚洲视频精品 | 欧美专区在线观看 | 免费黄色小视频 | 成人免费网站在线观看 | 男同在线观看 | 亚洲精品自拍视频 | 国产免费一级片 | 天天天天躁天天爱天天碰2018 | 亚洲精品午夜 | 成人精品在线视频 | 国产成人一区 | 四虎在线免费视频 | 成人免费黄色大片 | 国产三级黄色片 | 超碰777 | 久久九九免费视频 | 日本综合久久 | 911亚洲精品 | 久草国产视频 | 免费在线观看黄色片 | 亚洲欧美日韩在线 | 丝袜美腿一区二区三区 | 欧美成人小视频 | 日本一本在线 | 国产h视频 | 欧洲av网站 | 一级黄色片免费观看 | 欧美在线一级 | 黄色天天影视 | 国产视频在线观看视频 | av高清在线观看 | 国产欧美精品一区 | 国内久久精品 | 福利一区福利二区 | 特黄老太婆aa毛毛片 | 第一福利视频 |