1.新增了夜間模式欣尼,可在單獨頁面中關(guān)閉打開叠穆,也可在plist文件中全局設(shè)置
2.在iOS13中,通過KVC方式來獲取私有屬性,有Carsh風險,盡量避免使用.比如我們常用的UITextFiled和UISearchController等
1> iOS13之前修改UITextField的placeholder顏色時都是通過
//修改textField的占位符字體顏色
[textField setValue:[UIColor xxx] forKeyPath:@"_placeholderLabel.textColor"];
進行修改,現(xiàn)在需要通過修改其屬性字符串a(chǎn)ttributedPlaceholder來修改
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時丸逸,都不能使用KVC的方式來進行獲取某饰,需要通過遍歷其subViews來獲取
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時儒恋,在iOS13中把SearchBar中的textField直接暴露給開發(fā)者使用,無需在通過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中對于MPMoviePlayerController使用的廢棄,需要使用AVKit中的AVPlayerViewController來達到播放的目的。
4.Sign in with Apple 第三方登錄
當 Sign In with Apple 服務(wù)正式上線以后黔漂,所有已接入其它第三方登錄的 App诫尽,Sign In with Apple 將被要求作為一種登錄選擇, 否則有可能就不給過炬守。如果 APP 支持三方登陸(Facbook牧嫉、Google、微信减途、QQ酣藻、支付寶等),就必須支持蘋果登錄鳍置,且要放前邊辽剧。解決方法:未來上線之后,添加登錄入口即可。
5.即將廢棄的 LaunchImage
從 iOS 8 的時候税产,蘋果就引入了 LaunchScreen怕轿,我們可以設(shè)置 LaunchScreen來作為啟動頁。當然辟拷,現(xiàn)在你還可以使用LaunchImage來設(shè)置啟動圖撞羽。不過使用LaunchImage的話,要求我們必須提供各種屏幕尺寸的啟動圖梧兼,來適配各種設(shè)備放吩,隨著蘋果設(shè)備尺寸越來越多,這種方式顯然不夠 Flexible羽杰。而使用 LaunchScreen的話渡紫,情況會變的很簡單, LaunchScreen是支持AutoLayout+SizeClass的考赛,所以適配各種屏幕都不在話下惕澎。??從2020年4月開始,所有使? iOS13 SDK的 App將必須提供 LaunchScreen颜骤,LaunchImage即將退出歷史舞臺唧喉。可以使用Launch Storyboards來進行解決。
6.模態(tài)彈出默認交互改變
iOS 13 的 presentViewController 默認有視差效果八孝,模態(tài)出來的界面現(xiàn)在默認都下滑返回董朝。 一些頁面必須要點確認才能消失的,需要適配干跛。如果項目中頁面高度全部是屏幕尺寸子姜,那么多出來的導航高度會出現(xiàn)問題。
// Swift
self.modalPresentationStyle = .fullScreen
// Objective-C
self.modalPresentationStyle = UIModalPresentationFullScreen;
UIViewController 增加一個了屬性 isModalInPresentation楼入,默認為 false哥捕,當該屬性為 false 時,用戶下拉可以 dismiss 控制器嘉熊,為 true 時遥赚,下拉不可以 dismiss控制器。
7.UISegmentedControl 默認樣式改變?yōu)榘椎缀谧植簦薷倪^顏色的頁面需要修改
8.增加一直使用藍牙的權(quán)限申請
CBCentralManager凫佛,iOS13以前,使用藍牙時可以直接用泽腮,不會出現(xiàn)權(quán)限提示御蒲,iOS13后衣赶,再使用就會提示了诊赊。在info.plist里增加NSBluetoothAlwaysUsageDescription 我們要一直使用您的藍牙
9.廢棄 UISearchDisplayController
在 iOS 8 之前,我們在 UITableView 上添加搜索框需要使用 UISearchBar + UISearchDisplayController 的組合方式府瞄,而在 iOS 8 之后碧磅,蘋果就已經(jīng)推出了 UISearchController 來代替這個組合方式。在 iOS 13 中遵馆,如果還繼續(xù)使用 UISearchDisplayController 會直接導致崩潰
10.TabBar 選中文字顏色為藍色
if (@available(iOS 13.0, *)) {
[[UITabBar appearance] setUnselectedItemTintColor:[UIColor whiteColor]];
}
只需要將白色修改為你所需要的顏色即可鲸郊,原本設(shè)置過的選中樣式顏色會正常顯示
11.如果有特別長,特別繁瑣的代碼在一行中顯示货邓,swift時會提示讓你將代碼拆分秆撮,oc沒有嘗試