Set UITableView content inset permanently

前端 未结 8 769
余生分开走
余生分开走 2020-12-07 12:24

In my app I have a UISearchBar under UINavigationBar so it is always visible to user. In that case I had to set contentInset with extr

8条回答
  •  攒了一身酷
    2020-12-07 12:42

    automaticallyAdjustsScrollViewInsets is deprecated in iOS11 (and the accepted solution no longer works). use:

    if #available(iOS 11.0, *) {
        scrollView.contentInsetAdjustmentBehavior = .never
    } else {
        automaticallyAdjustsScrollViewInsets = false
    }
    

提交回复
热议问题