1,适配UITableView
1
2
3
4
5
6
7
|
if
#available(iOS11.
0
, *) {
self.contentInsetAdjustmentBehavior= .never
self.estimatedRowHeight=
0
self.estimatedSectionHeaderHeight=
0
self.estimatedSectionFooterHeight=
0
}
else
{
}
|
2,适配UIScrollView
1
2
3
4
|
if
#available(iOS11.
0
, *) {
scrollView?.contentInsetAdjustmentBehavior= .never
}
else
{
}
|
3,UITableView中的sectionHeader或者Footer显示不正常
还有的发现某些界面tableView的sectionHeader、sectionFooter高度与设置不符的问题,在iOS11中如果不实现-tableView: viewForHeaderInSection:和-tableView: viewForFooterInSection:,则-tableView: heightForHeaderInSection:和- tableView: heightForFooterInSection:不会被调用,导致它们都变成了默认高度,这是因为tableView在iOS11默认使用Self-Sizing,tableView的estimatedRowHeight、estimatedSectionHeaderHeight、estimatedSectionFooterHeight三个高度估算属性由默认的0变成了UITableViewAutomaticDimension,解决办法简单粗暴,就是实现对应方法或把这三个属性设为0。
4,适配网页加载不全下面有白边
1
2
3
4
|
if
#available(iOS11.
0
, *) {
webView.scrollView.contentInsetAdjustmentBehavior= .never
}
else
{
}
|
5,适配iPhoneX不能铺满屏的问题
<1>给Brand Assets添加一张1125*2436大小的图片
打开Assets.xcassets文件夹,找到Brand Assets
右键Show in Finder
添加一张1125*2436大小的图片
<2>修改Contents.json文件,添加如下内容
1
2
3
4
5
6
7
8
9
|
{
"extent"
:
"full-screen"
,
"idiom"
:
"iphone"
,
"subtype"
:
"2436h"
,
"filename"
: "1125_2436.png”,
"minimum-system-version"
:
"11.0"
,
"orientation"
:
"portrait"
,
"scale"
:
"3x"
}
|
6,适配iPhoneX
1
2
3
4
5
|
//适配iPhoneX
letLL_iPhoneX = (kScreenW == Double(
375.0
) && kScreenH == Double(
812.0
) ?
true
:
false
)
letkNavibarH = LL_iPhoneX ? Double(
88.0
) : Double(
64.0
)
letkTabbarH = LL_iPhoneX ? Double(
49.0
+
34.0
) : Double(
49.0
)
letkStatusbarH = LL_iPhoneX ? Double(
44.0
) : Double(
20.0
)
|
7,xcode9打包注意事项
xcode9打包版本只能是8.2及以下版本,或者9.0及更高版本
xcode9不支持8.3和8.4版本
xcode9新打包要在构建版本的时候加入1024*1024 AppSore icon