AppDelegate.h
#import <UIKit/UIKit.h> #import "MainViewController.h" @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) UINavigationController *navigationController; @property (strong, nonatomic) MainViewController *mainViewController; @end
AppDelegate.m
#import "AppDelegate.h" @interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.backgroundColor = [UIColor whiteColor]; self.mainViewController = [[MainViewController alloc] init]; self.navigationController = [[UINavigationController alloc] initWithRootViewController:_mainViewController]; //[self.navigationController setNavigationBarHidden:YES]; self.window.rootViewController = _navigationController; [self.window makeKeyAndVisible]; return YES; } ... @end