How do I create a new Swift project without using Storyboards?

后端 未结 13 920
不知归路
不知归路 2020-11-29 15:47

Creating a new project in XCode 6 doesn\'t allow to disable Storyboards. You can only select Swift or Objective-C and to use or not Core Data.

I tried deleting the s

13条回答
  •  無奈伤痛
    2020-11-29 16:09

    You can just do it like this:

    class AppDelegate: UIResponder, UIApplicationDelegate {
        var window: UIWindow?
        var IndexNavigationController: UINavigationController?
    
        func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
            var IndexViewContoller : IndexViewController? = IndexViewController()
            self.IndexNavigationController = UINavigationController(rootViewController:IndexViewContoller)
            self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
            self.window!.rootViewController = self.IndexNavigationController
            self.window!.backgroundColor = UIColor.whiteColor()
            self.window!.makeKeyAndVisible()
            return true
        }
    }
    

提交回复
热议问题