iOS13 適配和Xcode11.0踩坑小結(jié)
iOS13中presentViewController的問(wèn)題
更新了Xcode11.0 beta之后,在iOS13中運(yùn)行代碼發(fā)現(xiàn)presentViewController
和之前彈出的樣式不一樣。
會(huì)出現(xiàn)這種情況是主要是因?yàn)槲覀冎皩?duì)UIViewController
里面的一個(gè)屬性,即modalPresentationStyle
(該屬性是控制器在模態(tài)視圖時(shí)將要使用的樣式)沒(méi)有設(shè)置需要的類型。在iOS13中modalPresentationStyle
的默認(rèn)改為UIModalPresentationAutomatic
,而在之前默認(rèn)是UIModalPresentationFullScreen
。
/* Defines the presentation style that will be used for this view controller when it is presented modally. Set this property on the view controller to be presented, not the presenter. If this property has been set to UIModalPresentationAutomatic, reading it will always return a concrete presentation style. By default UIViewController resolves UIModalPresentationAutomatic to UIModalPresentationPageSheet, but other system-provided view controllers may resolve UIModalPresentationAutomatic to other concrete presentation styles. Defaults to UIModalPresentationAutomatic on iOS starting in iOS 13.0, and UIModalPresentationFullScreen on previous versions. Defaults to UIModalPresentationFullScreen on all other platforms. */ @property(nonatomic,assign) UIModalPresentationStyle modalPresentationStyle API_AVAILABLE(ios(3.2));
要改會(huì)原來(lái)模態(tài)視圖樣式,我們只需要把UIModalPresentationStyle
設(shè)置為UIModalPresentationFullScreen
即可。
ViewController *vc = [[ViewController alloc] init]; vc.title = @"presentVC"; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc]; nav.modalPresentationStyle = UIModalPresentationFullScreen; [self.window.rootViewController presentViewController:nav animated:YES completion:nil];
私有KVC
在使用iOS 13運(yùn)行項(xiàng)目時(shí)突然APP就crash
掉了。定位到的問(wèn)題是在設(shè)置UITextField
的Placeholder
也就是占位文本的顏色和字體時(shí)使用了KVC的方法:
[_textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"]; [_textField setValue:[UIFont systemFontOfSize:14] forKeyPath:@"_placeholderLabel.font"];
可以將其替換為
_textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"姓名" attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14],NSForegroundColorAttributeName:[UIColor redColor]}];
并且只需要在初始化的時(shí)候設(shè)置attributedPlaceholder
即富文本的占位文本,再重新賦值依然使用placeolder
直接設(shè)置文本內(nèi)容,樣式不會(huì)改變。(想要這種效果的話需要在初始化attributedPlaceholder時(shí)的字符串不為空)
Universal Link(通用鏈接)
在Xcode11中配置Universal Link(通用鏈接)步驟:
在iOS13之前在其他APP去safari中打開Universal Link
(通用鏈接)系統(tǒng)匹配域名是全匹配,而在iOS13之后規(guī)則發(fā)生了變化,猜測(cè)是包含關(guān)系。比如在iOS13之前,如果Universal Link
(通用鏈接)為w.mydomain.com
那么在微信或者其他APP訪問(wèn)www.mydomain.com
然后點(diǎn)擊去safari打開則不會(huì)拉起相應(yīng)APP,而在iOS13則會(huì)拉起相應(yīng)APP。
而在safari中輸入的鏈接則依然和iOS之前一樣,只有www.mydomain.com
才會(huì)提示打開相應(yīng)APP。
修改APP名稱(修改DisplayName值)
- 在Xcode創(chuàng)建項(xiàng)目時(shí)默認(rèn)的
project.pbxproj
中的所有PRODUCT_NAME = "$(TARGET_NAME)"
;。 - 在Xcode11.0之前如果修改
DisplayName
時(shí)只是修改info.plist
中的Bundle display name
值,但是在Xcode11.0中修改該值則會(huì)把project.pbxproj
中的一個(gè)PRODUCT_NAME
改為修改后值,如果在項(xiàng)目中通過(guò)[NSBundle mainBundle] infoDictionary]
取kCFBundleExecutableKey
的就會(huì)有影響,并且對(duì)Build Settings
中的Packaing
中的一些名稱有影響,可能還會(huì)有其他影響有待關(guān)注。
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持我們。
上一篇:iOS13原生端適配攻略(推薦)
欄 目:IOS
下一篇:iOS13即將到來(lái),iOS推送DeviceToken適配方案詳解
本文標(biāo)題:iOS13 適配和Xcode11.0踩坑小結(jié)
本文地址:http://mengdiqiu.com.cn/a1/IOS/11865.html
您可能感興趣的文章


閱讀排行
- 1C語(yǔ)言 while語(yǔ)句的用法詳解
- 2java 實(shí)現(xiàn)簡(jiǎn)單圣誕樹的示例代碼(圣誕
- 3利用C語(yǔ)言實(shí)現(xiàn)“百馬百擔(dān)”問(wèn)題方法
- 4C語(yǔ)言中計(jì)算正弦的相關(guān)函數(shù)總結(jié)
- 5c語(yǔ)言計(jì)算三角形面積代碼
- 6什么是 WSH(腳本宿主)的詳細(xì)解釋
- 7C++ 中隨機(jī)函數(shù)random函數(shù)的使用方法
- 8正則表達(dá)式匹配各種特殊字符
- 9C語(yǔ)言十進(jìn)制轉(zhuǎn)二進(jìn)制代碼實(shí)例
- 10C語(yǔ)言查找數(shù)組里數(shù)字重復(fù)次數(shù)的方法
本欄相關(guān)
- 01-11UILabel顯示定時(shí)器文本跳動(dòng)問(wèn)題的解決
- 01-11iOS常用算法之兩個(gè)有序數(shù)組合并(要
- 01-11iOS 彈幕功能的實(shí)現(xiàn)思路圖解
- 01-11詳解MacOs免密登錄CentOs操作步驟
- 01-11iOS動(dòng)態(tài)更換Icon的全過(guò)程記錄
- 01-11iOS調(diào)試Block引用對(duì)象無(wú)法被釋放的小技
- 01-11iOS常見宏理解及使用方法
- 01-11iOS實(shí)現(xiàn)文本分頁(yè)的方法示例
- 01-11iOs遷至WKWebView跨過(guò)的一些坑
- 01-11iOS模擬中獎(jiǎng)名單循環(huán)滾動(dòng)效果
隨機(jī)閱讀
- 01-10SublimeText編譯C開發(fā)環(huán)境設(shè)置
- 04-02jquery與jsp,用jquery
- 01-11Mac OSX 打開原生自帶讀寫NTFS功能(圖文
- 08-05dedecms(織夢(mèng))副欄目數(shù)量限制代碼修改
- 08-05織夢(mèng)dedecms什么時(shí)候用欄目交叉功能?
- 01-10C#中split用法實(shí)例總結(jié)
- 01-11ajax實(shí)現(xiàn)頁(yè)面的局部加載
- 01-10delphi制作wav文件的方法
- 01-10使用C語(yǔ)言求解撲克牌的順子及n個(gè)骰子
- 08-05DEDE織夢(mèng)data目錄下的sessions文件夾有什