iOS11需要注意啦

2017-09-25  本文已影响0人  娜娜的世界123

1.适配TableView

在AppDelegate配置一次即可,方法如下

- (void)adaptationAfterIOS11UI {
    if (@available(iOS 11.0, *)) {
        [UITableView appearance].estimatedRowHeight = 0;
        [UITableView appearance].estimatedSectionFooterHeight = 0;
        [UITableView appearance].estimatedSectionHeaderHeight = 0;
    }
}

2.页面有时上部会留白

可以设置automaticallyAdjustsScrollViewInsets为 NO;
iOS11之后使用 Use UIScrollView's contentInsetAdjustmentBehavior instead

3.UISearchBar高度适配

SearchBar在Navi的titleView中,高度发生变化
解决办法:自定义View,重写系统方法,赋值给titleview。如下:

- (CGSize)intrinsicContentSize {
    if (@available(iOS 11.0, *)) {
        return UILayoutFittingCompressedSize;
    }
    return CGSizeZero;
}

note: 以后会继续补充的😄

上一篇 下一篇

猜你喜欢

热点阅读