Welcome reprint, please indicate the source.
Explanation: The project created with Xcode6 's empty project template is nothing, and inconvenient. This article first teaches you how to create an empty project containing a directory such as Target and appdelegate and add a Navigation view controller.
Step 1: Open Xcode6, then file-> New->project, Open and Select the single View application template , click Next, enter the project name, click Next, select Save location, Click Create.
Step 2: Select the project name, select the Info column in the configuration bar, delete the main storyboard file base name item in the custom IOS Target Properties Sub-column (i.e. click the "-" button):
Step 3: Delete the Xxxviewcontroller. h and. m files, and delete the Main.storyboard file;
Step 4: Create the root view controller, such as the name Rootviewcontroller (the name itself is defined):
Right-click on the project name to select New file, in the iOS section, select the source sub-column, select the Cocoa Touch class type template, tap Next, enter the controller file name Rootviewcontroller in the class entry, select Also Create XIB file, click Next, click Create.
Step 5: In the APPDELEGATE.M file,
Add Reference:#import "RootViewController.h"
Find the Didfinishlaunchingwithoptions method, clean up the contents of the method, and edit the contents as follows:
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions { Self.window = [[UIWindow alloc] Initwithframe:[uiscreen mainscreen].bounds]; [Self.window makekeyandvisible]; First View Controller rootviewcontroller *ROOTVC = [[Rootviewcontroller alloc] init]; Add the first view controller as a base stack view controller to the Navigation view Controller Uinavigationcontroller *navctr = [[Uinavigationcontroller alloc] INITWITHROOTVIEWCONTROLLER:ROOTVC]; Use the Navigation view controller as the root view controller self.window.rootViewController = navctr; return YES;}
Step 6: (optional) Add a caption to the Viewwillappear method in Rootviewcontroller:
-(void) Viewwillappear: (BOOL) animated{ [Super viewwillappear:animated]; Add title Self.navigationItem.title = @ "Rootviewcontroller";}
The results of the operation are as follows:
Xcode6 How to create a new empty Project + Add a Navigation view controller