小编典典

如何在iOS 7中使用Swift设置rootViewController

swift

我想在应用程序委托中设置rootViewController ..

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {

     var rootView: MyRootViewController = MyRootViewController()
     //Code to set this viewController as the root view??


     return true

}

阅读 570

收藏
2020-07-07

共1个答案

小编典典

你可以做这样的事情。

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {

     var rootView: MyRootViewController = MyRootViewController()

     if let window = self.window{
            window.rootViewController = rootView
     }

     return true
}
2020-07-07