標籤:uiwindow window make root 按鈕 建立 標頭檔 nav 檔案
1.建立類檔案FirstViewController,subClass of:UIViewController
2.建立類檔案MYNavigationController,subClass of:UINavigationController
3.AppDelegate.m中包含以上兩個標頭檔,然後在didFinishLaunchingWithOptions寫
FirstViewController *viewController = [[FirstViewController alloc]initWithNibName:nil bundle:nil];
MYNavigationController *navigationController = [[MYNavigationController alloc]initWithRootViewController:viewController];
self.window = [[UIWindow alloc]initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = navigationController;
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyWindow];
return YES;
4.返回按鈕設定
//返回按鈕
UIBarButtonItem *Return = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemReply target:self action:@selector(pop)];
self.navigationItem.leftBarButtonItems = @[Return];
ios navigationController代碼建立