1.新增了夜間模式,可在單獨(dú)頁(yè)面中關(guān)閉打開,也可在plist文件中全局設(shè)置
2.在iOS13中,通過KVC方式來(lái)獲取私有屬性,有Carsh風(fēng)險(xiǎn),盡量避免使用.比如我們常用的UITextFiled和UISearchController等
1> iOS13之前修改UITextField的placeholder顏色時(shí)都是通過
//修改textField的占位符字體顏色
[textField setValue:[UIColor xxx] forKeyPath:@"_placeholderLabel.textColor"];
進(jìn)行修改,現(xiàn)在需要通過修改其屬性字符串a(chǎn)ttributedPlaceholder來(lái)修改
UITextField *textfield = [[UITextField alloc]init];
NSMutableAttributedString *arrStr = [[NSMutableAttributedString alloc]initWithString:textfield.placeholder attributes:@{NSForegroundColorAttributeName : [UIColor redColor],NSFontAttributeName:[UIFont systemFontOfSize:12]}];
textfield.attributedPlaceholder = arrStr;
2> 獲取UISearchBar的cancleButton時(shí),都不能使用KVC的方式來(lái)進(jìn)行獲取,需要通過遍歷其subViews來(lái)獲取
if ([[[UIDevice currentDevice]systemVersion] floatValue] >= 13.0) {
for(id cc in [self.searchBar subviews]) {
for (id zz in [cc subviews]) {
for (id gg in [zz subviews]) {
if([gg isKindOfClass:[UIButton class]]){
UIButton *cancelButton = (UIButton *)gg;
[cancelButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
}
}
}
}
}else{
UIButton*cancelButton = (UIButton *)[self.searchBar getVarWithName:@"_cancelButton"];
[cancelButton setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
}
3> 獲取UISearchBar的textField時(shí),在iOS13中把SearchBar中的textField直接暴露給開發(fā)者使用,無(wú)需在通過kvc獲取
- (UITextField *)getSearchTextFiled{
if ([[[UIDevice currentDevice]systemVersion] floatValue] >= 13.0) {
return self.searchTextField;
}else{
UITextField *searchTextField = [self valueForKey:@"_searchField"];
return searchTextField;
}
}
3.MPMoviePlayerController在iOS13中廢棄
MPMoviePlayerController is no longer available. Use AVPlayerViewController in AVKit.
在iOS13中對(duì)于MPMoviePlayerController使用的廢棄,需要使用AVKit中的AVPlayerViewController來(lái)達(dá)到播放的目的。
4.Sign in with Apple 第三方登錄
當(dāng) Sign In with Apple 服務(wù)正式上線以后,所有已接入其它第三方登錄的 App,Sign In with Apple 將被要求作為一種登錄選擇, 否則有可能就不給過。如果 APP 支持三方登陸(Facbook、Google、微信、QQ、支付寶等),就必須支持蘋果登錄,且要放前邊。解決方法:未來(lái)上線之后,添加登錄入口即可。
5.即將廢棄的 LaunchImage
從 iOS 8 的時(shí)候,蘋果就引入了 LaunchScreen,我們可以設(shè)置 LaunchScreen來(lái)作為啟動(dòng)頁(yè)。當(dāng)然,現(xiàn)在你還可以使用LaunchImage來(lái)設(shè)置啟動(dòng)圖。不過使用LaunchImage的話,要求我們必須提供各種屏幕尺寸的啟動(dòng)圖,來(lái)適配各種設(shè)備,隨著蘋果設(shè)備尺寸越來(lái)越多,這種方式顯然不夠 Flexible。而使用 LaunchScreen的話,情況會(huì)變的很簡(jiǎn)單, LaunchScreen是支持AutoLayout+SizeClass的,所以適配各種屏幕都不在話下。??從2020年4月開始,所有使? iOS13 SDK的 App將必須提供 LaunchScreen,LaunchImage即將退出歷史舞臺(tái)??梢允褂肔aunch Storyboards來(lái)進(jìn)行解決。
6.模態(tài)彈出默認(rèn)交互改變
iOS 13 的 presentViewController 默認(rèn)有視差效果,模態(tài)出來(lái)的界面現(xiàn)在默認(rèn)都下滑返回。 一些頁(yè)面必須要點(diǎn)確認(rèn)才能消失的,需要適配。如果項(xiàng)目中頁(yè)面高度全部是屏幕尺寸,那么多出來(lái)的導(dǎo)航高度會(huì)出現(xiàn)問題。
// Swift
self.modalPresentationStyle = .fullScreen
// Objective-C
self.modalPresentationStyle = UIModalPresentationFullScreen;
UIViewController 增加一個(gè)了屬性 isModalInPresentation,默認(rèn)為 false,當(dāng)該屬性為 false 時(shí),用戶下拉可以 dismiss 控制器,為 true 時(shí),下拉不可以 dismiss控制器。
7.UISegmentedControl 默認(rèn)樣式改變?yōu)榘椎缀谧?,修改過顏色的頁(yè)面需要修改
8.增加一直使用藍(lán)牙的權(quán)限申請(qǐng)
CBCentralManager,iOS13以前,使用藍(lán)牙時(shí)可以直接用,不會(huì)出現(xiàn)權(quán)限提示,iOS13后,再使用就會(huì)提示了。在info.plist里增加NSBluetoothAlwaysUsageDescription 我們要一直使用您的藍(lán)牙
9.廢棄 UISearchDisplayController
在 iOS 8 之前,我們?cè)?UITableView 上添加搜索框需要使用 UISearchBar + UISearchDisplayController 的組合方式,而在 iOS 8 之后,蘋果就已經(jīng)推出了 UISearchController 來(lái)代替這個(gè)組合方式。在 iOS 13 中,如果還繼續(xù)使用 UISearchDisplayController 會(huì)直接導(dǎo)致崩潰
10.TabBar 選中文字顏色為藍(lán)色
if (@available(iOS 13.0, *)) {
[[UITabBar appearance] setUnselectedItemTintColor:[UIColor whiteColor]];
}
只需要將白色修改為你所需要的顏色即可,原本設(shè)置過的選中樣式顏色會(huì)正常顯示
11.如果有特別長(zhǎng),特別繁瑣的代碼在一行中顯示,swift時(shí)會(huì)提示讓你將代碼拆分,oc沒有嘗試