如何使用Swift,iOS 7设置rootViewController

前端之家收集整理的这篇文章主要介绍了如何使用Swift,iOS 7设置rootViewController前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在应用程序委托中设置rootViewController ..
func application(application: UIApplication,didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {

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


     return true

}
你可以这样做。
func application(application: UIApplication,didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {

     var rootView: MyRootViewController = MyRootViewController()

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

     return true
}
原文链接:https://www.f2er.com/swift/320495.html

猜你在找的Swift相关文章