在iOS13中modalPresentationStyle的默認改成UIModalPresentationAutomatic,而在以前默認是UIModalPresentationFullScreen。bash
要改會原來模態視圖樣式,咱們只須要把UIModalPresentationStyle設置爲UIModalPresentationFullScreen便可微信
若是是從控制器跳轉的,這個屬性設置在控制器
若是是封裝了一個單獨的導航欄跳轉,則這個屬性設置在導航欄app
iOS不容許valueForKey、setValue: forKey獲取和設置私有屬性,須要使用其它方式修改ui
如:this
[textField setValue:[UIColor red] forKeyPath:@"_placeholderLabel.textColor」]; [textField setValue:[UIFont boldSystemFontOfSize:12] forKeyPath:@"_placeholderLabel.font"]; 複製代碼
//替換爲spa
textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@「請輸入」attributes:
@{NSForegroundColorAttributeName:[UIColor red],NSFontAttributeName:[UIFont boldSystemFontOfSize:12]}];
複製代碼
我還遇到了以下的寫法:(獲取默認文字的顏色,並用一個UIColor接收。目前還沒找到合適的替換方法,若是你有比較好的方案可在下方留言!)code
UIColor *color = [textField valueForKeyPath:@"_placeholderLabel.textColor"];
複製代碼
Sign in with Apple -提供第三方登陸的注意啦orm
若是你的應用使用了第三方登陸,那麼你可能也須要加下 「Sign in with Apple」.
Sign In with Apple will be available for beta testing this summer. It will be required as an option
for users in apps that support third-party sign-in when it is commercially available later this year.cdn
若是蘋果開發者提供任何其餘第三方登陸,同時須要提供「蘋果登陸」選項。也就是說,若是軟件要求「微信登陸」或是「QQ登陸」時,必須同時提供「蘋果登陸」的選項給用戶自行選擇。根據蘋果公司最新公佈的指南,要求開發者在蘋果終端的應用程序登陸界面上,將「蘋果登陸」選項列在任何其餘第三方登陸的選項之上。token
雖然這只是蘋果的指南建議,並不是蘋果商店的審查要求,可是開發者認爲這無疑是經過蘋果審覈的一個好方法
官方Demo:點我下載
TextField
升級到iOS13,UISearchController上的SearchBar顯示異常,查看後發現對應的高度只有1px,目前沒找到具體致使的緣由,解決辦法是使用KVO監聽frame值變化後設置去應該顯示的高度
黑線處理crash
以前爲了處理搜索框的黑線問題會遍歷後刪除UISearchBarBackground,在iOS13會致使UI渲染失敗crash; 解決辦法是設置UISearchBarBackground的layer.contents爲nil
public func clearBlackLine() {
for view in self.subviews.last!.subviews {
if view.isKind(of: NSClassFromString("UISearchBarBackground")!) {
view.backgroundColor = UIColor.white
view.layer.contents = nil
break
}
}
}
複製代碼
若是以前有經過TabBar上圖片位置來設置紅點位置,在iOS13上會發現顯示位置都在最左邊去了。遍歷UITabBarButton的subViews發現只有在TabBar選中狀態下才能取到UITabBarSwappableImageView,解決辦法是修改成經過UITabBarButton的位置來設置紅點的frame
MPMoviePlayerController 在iOS 13已經不能用了
'MPMoviePlayerController is no longer available. Use AVPlayerViewController in AVKit.'
解決方案:既然不能再用了,那隻能換掉了。替代方案就是AVKit裏面的那套播放器。(DDW使用的AVKit)
iOS 13 DeviceToken有變化,原有的方法已經沒法獲取到準確的DeviceToken字符串了
NSString *dt = [deviceToken description];
dt = [dt stringByReplacingOccurrencesOfString: @"<" withString: @""];
dt = [dt stringByReplacingOccurrencesOfString: @">" withString: @""];
dt = [dt stringByReplacingOccurrencesOfString: @" " withString: @""];
這段代碼運行在 iOS 13 上已經沒法獲取到準確的DeviceToken字符串了,iOS 13 經過[deviceToken description]獲取到的內容已經變了。
複製代碼
解決方案
-(void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
if (![deviceToken isKindOfClass:[NSData class]]) return;
const unsigned *tokenBytes = [deviceToken bytes];
NSString *hexToken = [NSString stringWithFormat:@"%08x%08x%08x%08x%08x%08x%08x%08x",
ntohl(tokenBytes[0]), ntohl(tokenBytes[1]), ntohl(tokenBytes[2]),
ntohl(tokenBytes[3]), ntohl(tokenBytes[4]), ntohl(tokenBytes[5]),
ntohl(tokenBytes[6]), ntohl(tokenBytes[7])];
NSLog(@"deviceToken:%@",hexToken);
}
複製代碼
即將廢棄的 LaunchImage
從 iOS 8 的時候,蘋果就引入了 LaunchScreen,咱們能夠設置
LaunchScreen來做爲啓動頁。固然,如今你還可使用
LaunchImage來設置啓動圖。不過使用LaunchImage的話,要求咱們必須提供各類屏幕尺寸的啓動圖,來適配各類設備,
隨着蘋果設備尺寸愈來愈多,這種方式顯然不夠 Flexible。而使用 LaunchScreen的話,狀況會變的很簡單,
LaunchScreen是支持AutoLayout+SizeClass的,因此適配各類屏幕都不在話下。
注意啦,從2020年4月開始,全部使⽤ iOS13 SDK的 App將必須提供 LaunchScreen,LaunchImage即將退出歷史舞臺。
如發現遺漏或者錯誤,請在下方評論區留言。