標籤:cell .com scroll view logs span UI 多個 star
https://stackoverflow.com/questions/45573829/weird-uitableview-behaviour-in-ios11-cells-scroll-up-with-navigation-push-anima
在你的tablview/controller基類設定
if (@available(ios 11.0,*)) { self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; }
不要用 `[UIScrollView appearance]
` 的方法, 不生效.
PS: 搜尋這個問題的話, 國內的多個文章都是抄的同一篇, 且是錯的.
如下是錯的.
- 目前發現所有的Scrollview 及其子類都需要設定 contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever ,
- 工程中大量使用列表的同學不要慌,不要忙,因為UIView及其子類都遵循UIAppearance協議,我們可以進行全域配置:
-
- // AppDelegate 進行全域設定
- if (@available(iOS 11.0, *)){
- [[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
- }
-
- 這樣一來使用UITableview 、UICollectionView、UIScrollview的時候就不需要再單獨設定該屬性了。
[iOS11] contentInsetAdjustmentBehavior 問題, push back時, 介面會上下移動.