Turn from:
http://blog.csdn.net/smile_po/article/details/78341685
http://blog.csdn.net/sodaslay/article/details/78191227
One upgrade iOS11 adaptation
1.1, suitable for UITableView
if#available(iOS11.0, *) {self.contentInsetAdjustmentBehavior= .neverself.estimatedRowHeight=0self.estimatedSectionHeaderHeight=0self.estimatedSectionFooterHeight=0}else{}
1.2, suitable for Uiscrollview
if#available(iOS11.0, *) {scrollView?.contentInsetAdjustmentBehavior= .never}else{}
The Sectionheader or footer in 1.3,uitableview are not displayed properly
Also found that some interface TableView Sectionheader, sectionfooter height and settings do not match the problem, in iOS11 if not implemented-tableview:viewforheaderinsection: and-tableview:viewforfooterinsection:, then-tableview:heightforheaderinsection: and-tableview:heightforfooterinsection: Will not be called, causing them to become the default heights, because TableView uses Self-sizing,tableview's estimatedrowheight by default in IOS11, Estimatedsectionheaderheight, estimatedsectionfooterheight Three height estimate properties are changed from the default of 0 to Uitableviewautomaticdimension, The solution is simple and rude, which is to implement the corresponding method or set the three attributes to 0.
1.4, suitable for the page loading is not full below the white edge
if#available(iOS11.0, *) {webView.scrollView.contentInsetAdjustmentBehavior= .never}else{}
1.5 If the masonry is used for layout, it is necessary to fit Safearea
if ([UIDevice currentDevice].systemVersion.floatValue >= 11.0) { make.edges.equalTo(self.view.safeAreaInsets); } else { make.edges.equalTo(self.view); }
Two Iphonex adaptation
2.1 The problem of Iphonex can not be covered with the full screen
Scenario One: Add a 1125*2436-sized picture to brand Assets, open the Assets.xcassets folder, find brand Assets, right-click the show in Finder, and add a 1125*2436-sized picture.
Scenario Two: Modify the Contents.json file, add the following content
{"extent" : "full-screen","idiom" : "iphone","subtype" : "2436h","filename" : "1125_2436.png”,"minimum-system-version" : "11.0","orientation" : "portrait","scale" : "3x"}
2.2 Adapter Iphonex
//适配iPhoneXlet LL_iPhoneX = (kScreenW == Double(375.0) && kScreenH == Double(812.0) ?true:false)let kNavibarH = LL_iPhoneX ? Double(88.0) : Double(64.0)let kTabbarH = LL_iPhoneX ? Double(49.0+34.0) : Double(49.0)let kStatusbarH = LL_iPhoneX ? Double(44.0) : Double(20.0)
2.3 Device Information
if ([Devicestring isequaltostring:@"iphone10,1"])return @"IPhone 8";if ([Devicestring isequaltostring:@"iphone10,4"]) return @"IPhone 8"; if ([devicestring isequaltostring:@"iphone10,2"]) return @"IPhone 8 Plus"; if ([devicestring isequaltostring:@"iphone10,5"]) return @"IPhone 8 Plus"; if ([devicestring isequaltostring:@"iphone10,3"]) return @"IPhone X"; if ([devicestring isequaltostring:@"iphone10,6"]) return @"IPhone X";
Three Xcode9 packing
Xcode9 Package version can only be 8.2 and below, or 9.0 and later
Ios11&iphonex Adaptation &XCODE9 Packaging considerations