Swift 4.0 创建导航

AppDelegate.swift中

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
       //定义viewcontrol常量
       let vc=ViewController()
       //定义一个nav常量将视图添加进去
       let nav=UINavigationController(rootViewController: vc)
       //将nav添加
     self.window?.rootViewController=nav
     //导航颜色
     self.window?.backgroundColor=UIColor.white
        return true
    }

猜你喜欢

转载自blog.csdn.net/qq_43361450/article/details/84952774