How to set the rootViewController with Swift, iOS 7

后端 未结 5 2165
暗喜
暗喜 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:19

    In order to get it to show there are some things you need to do if you are not using a storyboard. Inside the AppDelegate inside the function application.

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.
    
        let frame = UIScreen.mainScreen().bounds
        window = UIWindow(frame: frame)
    
        let itemsViewControler: UITableViewController = BNRItemsViewController()
        if let window = self.window{
            window.rootViewController = itemsViewControler
            window.makeKeyAndVisible()
        }
    
        return true
    }
    

提交回复
热议问题