1. The simplest only one controller of the root page (without the default storyrboard)
Appdelegate.m
#import "AppDelegate.h"
#import "KCMainViewController.h"
@interface appdelegate ()
@end
@implementation appdelegate
-(BOOL) application: (uiapplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchoptions {
self. Window = [[uiwindow alloc]initwithframe: [[UIScreen mainscreen] bounds]];
Kcmainviewcontroller *mainview = [[Kcmainviewcontroller alloc]initwithnibname:@ "Kcmainviewcontroller" bundle:nil];
_window. Rootviewcontroller = MainView;
[_window makekeyandvisible];
return YES;
}
2. Root page of multiple controllers set with navigation
1) AppDelegate.h
#import <UIKit/UIKit.h>
@interface appdelegate:uiresponder <uiapplicationdelegate>
@property (Strong, nonatomic) uiwindow *window;
@property (Strong, nonatomic) uinavigationcontroller *navigationcontroller;
@end
2) APPDELEGATE.M
(BOOL) application: (uiapplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchoptions {
self. Window = [[uiwindow alloc]initwithframe: [[uiscreen mainscreen]bounds]];
self. Window. backgroundcolor = [Uicolor whitecolor];
Registerviewcontroller *masterviewcontroller = [[Registerviewcontroller alloc]initwithnibname :@ "Registerviewcontroller" bundle:nil];
_navigationcontroller = [[uinavigationcontroller alloc]initwithrootviewcontroller: Masterviewcontroller];
[_window addsubview: _navigationcontroller. View];
[self. Window makekeyandvisible];
}
Here to say a little more page jump things, if used navigation, is the agent of the Navigationcontroller Pushviewcontroller method to put the new controller into the navigation stack, the use of "last first out" principle, Toggles the page.
3. Setting up the root controller with Tabbar
-(BOOL) application: (uiapplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchoptions {
self. Window = [[uiwindow alloc] initwithframe: [[UIScreen mainscreen] bounds]];
Ggtabbarcontroller *tabbar = [[Ggtabbarcontroller alloc] init];
TestViewController1 *vc1 = [[TestViewController1 alloc] init];
Vc1.tabBarItem.title = @ " take time";??
Vc1.tabBarItem.badgeValue = @ "12";
TestViewController2 *VC2 = [[TestViewController2 alloc] init];
TestViewController3 *vc3 = [[TestViewController3 alloc] init];
TabBar. viewcontrollers = @[vc1, VC2, Vc3];
self. Window. Rootviewcontroller = TabBar;
self. Window. backgroundcolor = [Uicolor whitecolor];
[self. Window makekeyandvisible];
return YES;
}
IOS appdelegate Settings Root page