How to set the rootViewController with Swift, iOS 7

后端 未结 5 2163
暗喜
暗喜 2020-12-05 17:59

I want to set the rootViewController in the app delegate ..

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDicti         


        
5条回答
  •  醉梦人生
    2020-12-05 18:37

    You can do something like this.

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
    
         var rootView: MyRootViewController = MyRootViewController()
    
         if let window = self.window{
                window.rootViewController = rootView
         }
    
         return true
    }
    

提交回复
热议问题