scrollsToTop使用技巧

情景描述

在有TableView和ScrollView的界面中,點擊屏幕的Status Bar便可回到頂部,這是由於ScrollView的property scrollsToTop默認爲YES。ios

使用須知

在蘋果文檔中特別強調app

On iPhone, the scroll-to-top gesture has no effect if there is more than one scroll view on-screen that has scrollsToTop set to YES.code

潛在的問題

屏幕中有多個ScrollView或者其子類,此時點擊Status Bar不能返回頂部。

例如code4app網易新聞Demo在使用過程當中就出現了屏幕上包含多個ScrollView及其子類TableView的狀況。文檔

解決方法

只設置一個ScrollView的scrollsToTop爲YES,其餘設置爲NOget

相關文章
相關標籤/搜索