一治专、iPhone設(shè)備變遷
15款iphone推捐、5種不同比例的屏幕
3GS裂问、3G: 320*480 @1x 320*480像素分辨率 3.5英寸
4S、4牛柒、 320*480 @2x 640*960像素分辨率 3.5英寸
SE堪簿、5S、5C皮壁、5: 320*568 @2x 640*1136像素分辨率 4.0英寸
8椭更、7、6S蛾魄、6: 375*667 @2x 750*1334像素分辨率 4.7英寸
8P虑瀑、7P、6SP滴须、6P: 414*736 @3x 1080*1920(1.15)像素分辨率 5.5英寸
8X: 375*812 @3x 1125*2436像素分辨率 5.8英寸
預(yù)裝系統(tǒng)舌狗;https://baike.baidu.com/item/iPhone/238239
1 ios1 07
3g/2g ios2 08
3gs ios3 09
4 ios4 10
4s ios5 11
5 ios6 12
5s,5c ios7 13
6,6p ios8 14
6s,6sp,se ios9 15
7,7p ios10 16
8,8p,8x ios11 17
支持的模擬器,4s,5,5c,5s,6,6p 最低版本都是從iOS 8.0開始扔水;
6s,6sp, se 最低從iOS 9.0開始;
7,7p 最低從iOS 10.0開始痛侍;
8,8p,8x最低從iOS 11.0開始魔市。
375*667 SafeArea
375*812 SafeArea
帶標(biāo)簽欄 : 812- 44-49-34=685
帶導(dǎo)航欄: 812-44-44-49-34=641
44導(dǎo)航欄主届,
49標(biāo)簽欄,
34底部空白待德,
44(32+12)頂部空白
二岂膳、編譯器xcode 9 帶來的變化
1,無線調(diào)試
2,代碼塊提示磅网。 鼠標(biāo)移到for上按下command鍵
對class谈截, func, if, for都有效簸喂。
3毙死,command+control再點擊,快速跳轉(zhuǎn)到定義喻鳄。
4扼倘、command+點擊,彈出菜單
跳轉(zhuǎn)到定義
顯示了快速幫助
scope
重命名
5除呵、New Color Set
Assets.xcassets加入有名字的顏色再菊。
使用IB構(gòu)建UI可以享受到這一個福利
6、 Debug View Hierarchy
xcode8只能看到controller的view
xcode9可以看到controller
7颜曾、 Xcode 9 上面區(qū)分了 Group 和 Folder纠拔,所以也提供了 Create Group without Folder。
并且 Group 的圖標(biāo)是有個角的泛豪, 原來的關(guān)聯(lián)的虛擬的group稠诲,如果沒有對應(yīng)絕對路徑的文件夾,則會顯示紅色的诡曙。
三臀叙、iOS11系統(tǒng) 帶來的變化
1, Navigation title 放大了導(dǎo)航欄的標(biāo)題字體
// 設(shè)置為true:self.navigationItem.largeTitleDisplayMode設(shè)置价卤,顯示大標(biāo)題模式劝萤,也可以顯示小標(biāo)題模式。
// 設(shè)置為false:self.navigationItem.largeTitleDisplayMode設(shè)置大標(biāo)題不起作用慎璧。
self.navigationController.navigationBar.prefersLargeTitles =true;
self.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeNever;
提供了一套類似Files App的界面床嫌。可以獲取用戶設(shè)備上的炸卑,或者云端的文件既鞠。
FileProvider
FileProviderUI
3.不再支持32位APP: 意思是說32位Only的APP在iOS 11上跑不起來煤傍。這在iOS 10上是可以的盖文。
64位系統(tǒng),跑32位軟件: iOS11不可以蚯姆,iOS10和以下可以五续。
32位系統(tǒng),跑64位軟件:不能龄恋。
真機架構(gòu).a
armv7(32位): 3gs,4,4s
armv7s(32位): 5,5c
arm64(64位): 5s和以上
模擬器架構(gòu).a
i386(32位):4,4s,5,5c
x86_64(64位):5s和以上
4疙驾、增加DeviceCheckAPI。追蹤用戶郭毕。
你在設(shè)備上用 DeviceCheck API 生成一個 token它碎,然后將這個 token 發(fā)給自己的服務(wù)器,再由自己的服務(wù)器與 Apple 的 API 進(jìn)行通訊,來更新或者查詢該設(shè)備的值扳肛。這兩個 bit 的數(shù)據(jù)用來追蹤用戶比如是否已經(jīng)領(lǐng)取獎勵這類信息傻挂。
5、PDfkit顯示和操作PDF文件挖息。
6金拒、
IdentityLookup - 可以自己開發(fā)一個 app extension 來攔截系統(tǒng) SMS 和 MMS 的信息。系統(tǒng)的信息 app 在接到未知的人的短信時套腹,會詢問所有開啟的過濾擴展绪抛,如果擴展表示該消息應(yīng)當(dāng)被攔截,那么這則信息將不會傳遞給你电禀。擴展有機會訪問到事先指定的 server 來進(jìn)行判斷 (所以說你可以光明正大地獲取用戶短信內(nèi)容了幢码,不過當(dāng)然考慮到隱私,這些訪問都是匿名加密的鞭呕,Apple 也禁止這類擴展在 container 里進(jìn)行寫入)蛤育。
只能讀信息,不能篡改信息葫松。
7瓦糕、iPhone7/7Plus上提供CoreNFC支持。
上提供基礎(chǔ)的近場通訊讀取功能腋么」韭Γ看起來很 promising,只要你有合適的 NFC 標(biāo)簽珊擂,手機就可以進(jìn)行讀取圣勒。但是考慮到無法后臺常駐,實用性就打了折扣摧扇。
8圣贸、AutoFill
從 iCloud Keychain 中獲取密碼,然后自動填充的功能現(xiàn)在開放給第三方開發(fā)者了扛稽。UITextInputTraits 的 textContentType 中添加了 username 和 password吁峻,對適合的 text view 或者 text field 的 content type 進(jìn)行配置,并填寫 Info.plist 的相關(guān)內(nèi)容在张,就可以在要求輸入用戶名密碼時獲取鍵盤上方的自動填充用含,幫助用戶快速登錄。
9帮匾、增加系統(tǒng)條件@available
if (@available(iOS 10.3, *)) {
10.3的API
} else {
10.3系統(tǒng)一下的API
}
if (@available(iOS 11.0, *)) {
} else {
}
10啄骇、增加了AutoLayout增加了約束條件。
四瘟斜、具體遇到的適配問題
1缸夹、iOS11中AppIcon設(shè)置無效的問題
https://github.com/mythkiven/developTips
據(jù)說是Cocopods的問題痪寻。 如果不用Cocoapods確實可以。增加1024圖片即可虽惭。
直接在InfoPlist中配也可以有效
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>UIPrerenderedIcon</key>
<false/>
<key>CFBundleIconFiles</key>
<array>
<string>1024x1024.png</string>
<string>Icon-60@2x.png</string>
<string>Icon-60@3x.png</string>
<string>Icon-Notification@2x.png</string>
<string>Icon-Notification@3x.png</string>
<string>Icon-Small-40@2x.png</string>
<string>Icon-Small-40@3x.png</string>
<string>Icon-Small@2x.png</string>
<string>Icon-Small@3x.png</string>
</array>
</dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>1</key>
<dict>
<key>UIPrerenderedIcon</key>
<false/>
<key>CFBundleIconFiles</key>
<array>
<string>icon22.png</string>
<string>icon22@2x.png</string>
<string>icon22@3x.png</string>
</array>
</dict>
</dict>
</dict>
2, 導(dǎo)航條按鈕問題
UIBarButtonSystemItemFixedSpace不管用了槽华? 還是默認(rèn)的左邊緣距離值修改了。
3趟妥、導(dǎo)航條大標(biāo)題模式
大標(biāo)題模式
(0 20; 375 96) UINavigationBar
(0 -20; 375 116) _UIBarBackground
(0 44; 375 52) _UINavigationBarLargeTitleView
(0 0; 375 44) _UINavigationBarContentView
小標(biāo)題模式
(0 20; 375 44) UINavigationBar
(0 -20; 375 64) _UIBarBackground
(0 0; 375 44) _UINavigationBarContentView
// 設(shè)置為true:self.navigationItem.largeTitleDisplayMode設(shè)置猫态,顯示大標(biāo)題模式,也可以顯示小標(biāo)題模式披摄。
// 設(shè)置為false:self.navigationItem.largeTitleDisplayMode設(shè)置大標(biāo)題不起作用亲雪。
self.navigationController.navigationBar.prefersLargeTitles =true;
//
self.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeNever;
總結(jié):
8x: 導(dǎo)航欄88+搜索框(如果有)52
8:導(dǎo)航欄64+搜索框(如果有)52
大標(biāo)題:
8x: 導(dǎo)航欄140(大標(biāo)題52)+搜索框(如果有)52
8:導(dǎo)航欄116(大標(biāo)題52)+搜索框(如果有)52
5、 設(shè)置導(dǎo)航欄搜索控制器 searchController
UILayoutContainerView
UINaivgationTransitionView
UIViewContollerWrapperView
_UINavigationControllerPaletteClippingView//搜索框
UINavigationBar//導(dǎo)航條
大標(biāo)題模式:
(0 0; 375 667); _UINavigationControllerPaletteClippingView
(0 116; 375 52) _UINavigationControllerManagedSearchPalette
(0 0; 375 52) _UIBarBackground
(0 0; 375 52); UISearchBar
小標(biāo)題模式:
(0 0; 375 667); _UINavigationControllerPaletteClippingView
(0 64; 375 52) _UINavigationControllerManagedSearchPalette
(0 0; 375 52) _UIBarBackground
(0 0; 375 52); UISearchBar
激活狀態(tài)下:
搜索框:
(0 0; 375 667); _UINavigationControllerPaletteClippingView
(0 20; 375 50) _UINavigationControllerManagedSearchPalette
(0 -20; 375 70); _UIBarBackground
(0 0; 375 50); UISearchBar
導(dǎo)航條:
(0 -96; 375 96); UINavigationBar
(0 -20; 375 116) _UIBarBackground
(0 44; 375 52) _UINavigationBarLargeTitleView
(0 0; 375 44) _UINavigationBarContentView
總結(jié):
激活時:搜索框116高度疚膊。移到頂部义辕。導(dǎo)航條移到父view的外面。
4寓盗、scrollView頂部20像素空白問題
這篇文章總結(jié)的是最好的灌砖。https://mp.weixin.qq.com/s/W1_0VrchCO50owhJNmJnuQ
//UIScrollView
@property(nonatomic) UIScrollViewContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior API_AVAILABLE(ios(11.0),tvos(11.0));
@property(nonatomic, readonly) UIEdgeInsets adjustedContentInset API_AVAILABLE(ios(11.0),tvos(11.0));
//UITableView
@property (nonatomic) BOOL insetsContentViewsToSafeArea API_AVAILABLE(ios(11.0), tvos(11.0)); // default value is YES
//UIViewController
@property(nonatomic) UIEdgeInsets additionalSafeAreaInsets API_AVAILABLE(ios(11.0), tvos(11.0));
@property(nonatomic,assign) BOOL automaticallyAdjustsScrollViewInsets API_DEPRECATED_WITH_REPLACEMENT("Use UIScrollView's contentInsetAdjustmentBehavior instead", ios(7.0,11.0),tvos(7.0,11.0)); // Defaults to YES
//UIView
@property (nonatomic,readonly) UIEdgeInsets safeAreaInsets API_AVAILABLE(ios(11.0),tvos(11.0));
- (void)safeAreaInsetsDidChange API_AVAILABLE(ios(11.0),tvos(11.0));
UIViewContoller的automaticallyAdjustsScrollViewInsets過期,
改用UIScorllView的屬性 contentInsetAdjustmentBehavior來控制傀蚌。
修改contentInsetAdjustmentBehavior基显, 對應(yīng)為變化adjustedContentInset值。
UIScrollView/UITableView/UICollectionView
1)善炫、contentInset不會占用contentSize
2)撩幽、adjustedContentInset會導(dǎo)致ScrollView的contentOffset做對應(yīng)的值偏移
3)、inset不會改變ContentView的Frame的Orgin
真正的邊距由adjustedContentInset值決定
adjustedContentInset等于SafeAreaInsets和ContentInset兩個合并加成箩艺,形成真正的邊距窜醉。
5、 SafeArea布局艺谆。 9.0以上才可以用榨惰。
Safe Area Layout Guide before iOS 9.0
Safe Area Layout Guides
// UIViewController
@property(nonatomic,readonly,strong) id<UILayoutSupport> topLayoutGuide API_DEPRECATED_WITH_REPLACEMENT("-[UIView safeAreaLayoutGuide]", ios(7.0,11.0), tvos(7.0,11.0));
@property(nonatomic,readonly,strong) id<UILayoutSupport> bottomLayoutGuide API_DEPRECATED_WITH_REPLACEMENT("-[UIView safeAreaLayoutGuide]", ios(7.0,11.0), tvos(7.0,11.0));
//UIView
@property(nonatomic,readonly,strong) UILayoutGuide *safeAreaLayoutGuide API_AVAILABLE(ios(11.0),tvos(11.0));
@property(nonatomic,readonly,strong) UILayoutGuide *safeAreaLayoutGuide API_AVAILABLE(ios(11.0),tvos(11.0));
@property(readonly,strong) UILayoutGuide *layoutMarginsGuide NS_AVAILABLE_IOS(9_0);
@property (nonatomic, readonly, strong) UILayoutGuide *readableContentGuide NS_AVAILABLE_IOS(9_0);
@property (nonatomic) BOOL insetsLayoutMarginsFromSafeArea API_AVAILABLE(ios(11.0),tvos(11.0)); // Default: YES
6、
UITableView
UITableViewDataSourcePrefetching---prefetchRowsAtIndexPaths
UITableViewDragDelegate静汤、UITableViewDropDelegate
UIScrollView:
XIB的ContentInset對iOS11有效琅催。
7、8x屏幕并沒有全屏的問題
在Contents.json增加
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "2436h",
"filename" : "Launchlmage-375-Portrait-812h@3x.png",
"minimum-system-version" : "11.0",
"orientation" : "portrait",
"scale" : "3x"
}
增加一張1125*2436的啟動圖片撒妈。