简体   繁体   中英

iOS 11 20 points gap over tableview in UITableViewController with static cells

在此处输入图片说明

I have been using a UITableViewController in my app. It worked fine in iOS 10.xx but I recently upgraded my Xcode and iOS to (Xcode 9 and iOS 11). Then the my app is having this UI issue. It will show a 20 points gap above the UITableView in a UITableViewController with static cells. Anyone having same problem and found the solution for this?

It is due to the new property introduced in iOS 11. Try the following:

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

chengsam 's answer works perfectly to solve this problem.

If you want to accomplish the iOS 11 part in Interface Builder, you can do so. It's available in the Size Selector in the Utilities View.

IB内容插入属性

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM