xcode 11 與 ios 13更新內容

  1. xcode 11 刪除application loader,如果需要使用可以從之前版本的xcode中提取路徑是/⁨application/⁨Xcode⁩/⁨Contents⁩

  2. 在xcode 11中 UIViewControllermodalPresentationStyle默認不再是全屏,所以當我們present視圖時,頂部會缺少一塊,想要改成全屏需要設置

vc.modalPresentationStyle = .fullScreen
  1. 在xcode 11 present出帶透明背景的視圖不顯示問題
    // in xcode 10
        let navc = NavigationController(rootViewController: vc)
        navc.modalPresentationStyle = .overCurrentContext
        navc.view.backgroundColor = .clear
        navc.navigationBar.isHidden = true
        self.present(navc, animated: true, completion: nil)
    // in xocde 11
    
            let navc = NavigationController(rootViewController: vc)
        navc.modalPresentationStyle = .overFullScreen
        navc.view.backgroundColor = .clear
        navc.navigationBar.isHidden = true
        inVC.present(navc, animated: true, completion: nil)

4.xcode 11 新建項目及配置

在xcode11中新建項目默認使用ios13 SDK創建,會直接將APP生命週期從APPdelegate轉交給SceneDelegate
項目文件結構如下

├── yourProject                                  // 項目文件
│   ├── yourProject                             // 源碼文件夾
│   │   ├── AppDelegate.swift           
│   │   ├── SceneDelegate.swift             
│   │   ├── ViewController.swift                    
│   │   ├── Main.storyboard                
│   │   ├── Assets.xcassets                     
│   │   │   └── shop.png                   
│   │   ├── LaunchScreen.storyboard                        
│   │   ├── Info.plist                

如果我們修改development target 低於13.0 編譯項目就會報錯,是由於新api(sceneDelegate)導致的,爲此我們需要將生命週期還原爲APPdelegate來管理,

  • 打開info.plis刪除Application Scene Manifest這一項
  • 刪除 SceneDelegate.swift 文件
  • 將APPdelegate進行如下修改

編譯後運行即可

未完待續。。。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章