iOS13中presentViewController的問題
讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來自于我們對這個行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價值的長期合作伙伴,公司提供的服務(wù)項目有:域名注冊、網(wǎng)頁空間、營銷軟件、網(wǎng)站建設(shè)、訥河網(wǎng)站維護(hù)、網(wǎng)站推廣。
更新了Xcode11.0 beta之后,在iOS13中運(yùn)行代碼發(fā)現(xiàn)presentViewController
和之前彈出的樣式不一樣。
會出現(xiàn)這種情況是主要是因為我們之前對UIViewController
里面的一個屬性,即modalPresentationStyle
(該屬性是控制器在模態(tà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));
要改會原來模態(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)行項目時突然APP就crash
掉了。定位到的問題是在設(shè)置UITextField
的Placeholder
也就是占位文本的顏色和字體時使用了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è)置attributedPlaceholder
即富文本的占位文本,再重新賦值依然使用placeolder
直接設(shè)置文本內(nèi)容,樣式不會改變。(想要這種效果的話需要在初始化attributedPlaceholder時的字符串不為空)
Universal Link(通用鏈接)
在Xcode11中配置Universal Link(通用鏈接)步驟:
在iOS13之前在其他APP去safari中打開Universal Link
(通用鏈接)系統(tǒng)匹配域名是全匹配,而在iOS13之后規(guī)則發(fā)生了變化,猜測是包含關(guān)系。比如在iOS13之前,如果Universal Link
(通用鏈接)為w.mydomain.com
那么在微信或者其他APP訪問www.mydomain.com
然后點擊去safari打開則不會拉起相應(yīng)APP,而在iOS13則會拉起相應(yīng)APP。
而在safari中輸入的鏈接則依然和iOS之前一樣,只有www.mydomain.com
才會提示打開相應(yīng)APP。
修改APP名稱(修改DisplayName值)
project.pbxproj
中的所有PRODUCT_NAME = "$(TARGET_NAME)"
;。DisplayName
時只是修改info.plist
中的Bundle display name
值,但是在Xcode11.0中修改該值則會把project.pbxproj
中的一個PRODUCT_NAME
改為修改后值,如果在項目中通過[NSBundle mainBundle] infoDictionary]
取kCFBundleExecutableKey
的就會有影響,并且對Build Settings
中的Packaing
中的一些名稱有影響,可能還會有其他影響有待關(guān)注。以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持創(chuàng)新互聯(lián)。
文章名稱:iOS13適配和Xcode11.0踩坑小結(jié)
URL分享:http://aaarwkj.com/article38/jjgpsp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄、、標(biāo)簽優(yōu)化、服務(wù)器托管、外貿(mào)網(wǎng)站建設(shè)、App開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)