How to create an empty ios project in xcode 6?

前端 未结 1 902
旧巷少年郎
旧巷少年郎 2021-01-29 01:14

i\'m using xcode 6 and they no longer have the \"empty project\" option when creating a new project, only a single view one...Is there an option to get it or it\'s gone and I ne

相关标签:
1条回答
  • 2021-01-29 02:03

    You need to deal with it, but it's easy. Start with the Single View application. Delete the storyboard and delete the reference to it in the Info.plist (so that there is no longer a main storyboard). If you like, delete the view controller class as well. Now just do everything from scratch in the app delegate's application:didFinishLaunchingWithOption:, just as you did in Xcode 5.

    I'm using Swift these days, so I'll show you what a pure code app delegate launch looks like in Swift; I'm sure you can translate into Objective-C:

    import UIKit
    
    @UIApplicationMain
    class AppDelegate : UIResponder, UIApplicationDelegate {
        var window : UIWindow?
    
        func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    
            self.window = UIWindow(frame:UIScreen.mainScreen().bounds)
            self.window!.rootViewController = ViewController() // or whatever you call it
            self.window!.backgroundColor = UIColor.whiteColor()
            self.window!.makeKeyAndVisible()
            return true
        }
    }
    
    0 讨论(0)
提交回复
热议问题