iOS11的适配
2017-09-22 本文已影响314人
找不到好的ID
关于最近的一个项目,升级了11之后遇到的一些问题,记录一下。
1.tabbar 上的红点没有了,因为我用的颜色是图片上取的渐变色,原因还不知道,深挖中,我的解决方案是换了一个颜色相近的。

之前代码
nav.tabBarItem.badgeColor = [UIColor gradientRedPinkColor];
+ (UIColor *)gradientRedPinkColor
{
return [UIColor colorWithPatternImage:[UIImage imageNamed:@"Gradient"]];
}
之后代码
nav.tabBarItem.badgeColor = [UIColor unt_redPinkColor];
+ (UIColor *)unt_redPinkColor
{
return [UIColor colorWithRed:251.0f / 255.0f green:52.0f / 255.0f blue:112.0f / 255.0f alpha:1.0f];
}

2.navigationBar上的自定义按钮,边距改变了,原因是iOS11对navigationController上的视图进行调整了。

之前代码中设置的空15距离没有效果了,很无奈。

之后代码,我设置了两个一样的按钮,只是第一个按钮是有图案的,有点投机取巧的意思,但是达到了目的,之后我发现更好的办法我会改掉的


3.tableview中的一些改动,如果你实现了下面两个分区高度的代理方法

却没有实现下面这两个分区视图的代理方法

你会发现区与区之间设置的高度是无效的

之后的代码,修改之后没有问题
设置estimatedSectionHeaderHeight和estimatedSectionFooterHeight
_tableView.estimatedSectionHeaderHeight = 0;
_tableView.estimatedSectionFooterHeight = 0;

4 我觉得UI上比较重要的一个属性取消了,大家在使用滑动控件的时候,遇到下移64的问题,一般都是通过这个解决的。


毫无办法,本来这个属性是写在父类控制器里面的,现在的话可能麻烦很多了。

5 我目前的适配方式是所有机型(5-7)看到的内容是一样多的,并不是采取大屏看到更多内容的方式,因为5-7的屏幕尺寸都是等比缩放过来的,我写间距的时候乘以了一个比例系数,这样做起来很方便。

但是iPhoneX的屏幕并不是等比缩放过来的,只高出一点来,以后的布局方式就变得多样了,这一点也不苹果,向安卓低头。
ps:其他的问题我暂时没有发现,欢迎大家补充。