
顯示黑條
1. 顯示黑條,即沒有沾滿屏幕,對于這個問題,添加一張 1125 * 2436的啟動圖即可.

啟動圖
2.關(guān)于 navi 在 iPhone X 上是88. 通過對 navi 圖層的觀察, navi 是從44開始的.其背景是向上偏移44,和之前狀態(tài)欄的思路是一樣的,只是偏移量不一樣.

navi 視圖

3.開發(fā)尺寸是375 * 812
ps: 如下面,由于要在 navi 上添加漸變的背景圖,要控制 navi 的高
- (UIImageView *)alphaView {
if (!_alphaView) {
CGRect frame = self.navigationBar.frame;
CGFloat h = SCREEN_HEIGHT == 812 ? 88 : 64;
UIImageView *alphaView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, h)];
alphaView.image = [UIImage imageNamed:@"bg_gradient"];
[self.navigationBar.subviews.firstObject insertSubview: alphaView atIndex:0];
_alphaView = alphaView;
}
return _alphaView;
}
4. tabbar的高度為83

tabbar
5.當(dāng)使用 ScrollView 時,默認偏移量是88;
iOS11上automaticallyAdjustsScrollViewInsets = false這句代碼失效
在 iOS11中添加了新的屬性contentInsetAdjustmentBehavior,這個屬性是個枚舉值
typedef NS_ENUM(NSInteger, UIScrollViewContentInsetAdjustmentBehavior) {
UIScrollViewContentInsetAdjustmentAutomatic, // Similar to .scrollableAxes, but for backward compatibility will also adjust the top & bottom contentInset when the scroll view is owned by a view controller with automaticallyAdjustsScrollViewInsets = YES inside a navigation controller, regardless of whether the scroll view is scrollable
UIScrollViewContentInsetAdjustmentScrollableAxes, // Edges for scrollable axes are adjusted (i.e., contentSize.width/height > frame.size.width/height or alwaysBounceHorizontal/Vertical = YES)
UIScrollViewContentInsetAdjustmentNever, // contentInset is not adjusted
UIScrollViewContentInsetAdjustmentAlways, // contentInset is always adjusted by the scroll view's safeAreaInsets
} API_AVAILABLE(ios(11.0),tvos(11.0));
/*
automatic 和scrollableAxes一樣,scrollView會自動計算和適應(yīng)頂部和底部的內(nèi)邊距并且在scrollView 不可滾動時,也會設(shè)置內(nèi)邊距.
scrollableAxes 自動計算內(nèi)邊距.
never不計算內(nèi)邊距
always 根據(jù)safeAreaInsets 計算內(nèi)邊距
*/
所以我們要對 scrollview 進行如下設(shè)置,才能解決偏移88的問題.
if #available(iOS 11.0, *) {
scrollerView.contentInsetAdjustmentBehavior = .never
}