2017-11-29 15 views
0

私は、XCode 8.3.3とオンラインで長い時間プロジェクトを構築しています。 しかし、iOS 11では、ScrollViewにはcontentInsetAdjustmentBehaviorという名前の新しいプロパティがあります。 これで、NavigationですべてのscrollViewdビヘイビアが異常になりました。 したがって、ScrollViewに固有のすべてのViewControllerに以下のコードを設定する必要があります。プロパティ値UIScrollView.content.contentInsetAdjustmentBehaviorをAppDelegateから決して変更しないでください。

if #available(iOS 11.0, *) { 
     self.tableView.contentInsetAdjustmentBehavior = .never 
    } 

このプロジェクトには多くのViewControllerがあるので、AppDelegateで設定するのは良い方法ですか?

UIScrollView.contentInsetAdjustmentBehavior = .never 

私がしようとしたが、XCodeの警告が

Result of call is unused, but produces 'UIScrollViewContentInsetAdjustmentBehavior' 

答えて

1

使用外観インスタンスです:

if #available(iOS 11, *) { 
    UIScrollView.appearance().contentInsetAdjustmentBehavior = .never 
} 
関連する問題