zoukankan      html  css  js  c++  java
  • IOS使用纯代码布局替换掉默认的storyboard

    在iOS11中,新增了SceneDelegate用来管理UI界面。之前在AppDelegate中操作window的代码应该都失效了。

    在11+中,都需要在SceneDelegate来管理。在scene函数中。有一大段注释

    // Use this method to optionally configure and attach the UIWindow window to the provided UIWindowScene scene.

    // If using a storyboard, the window property will automatically be initialized and attached to the scene.

    // This delegate does not imply the connecting scene or session are new (see application:configurationForConnectingSceneSession instead).

    于是在这里位置,加上自己的UIWindow管理

    
     let windScene = scene as! UIWindowScene;
            self.window = UIWindow.init(windowScene: windScene)
            self.window?.rootViewController = ViewController();
            self.window?.makeKeyAndVisible()
    
    

    个人觉得这里不需要用guard,直接转换UIWindowScene最好。

  • 相关阅读:
    WSGI原理
    主从数据库
    mysql高级
    记录
    获取当前时间
    sql注入和防sql注入
    python操作MySQL
    修改Windows10 命令终端cmd的编码为UTF-8
    MySQL查询
    MySQL数据库操作
  • 原文地址:https://www.cnblogs.com/boxrice/p/15725698.html
Copyright © 2011-2022 走看看