码迷,mamicode.com
首页 > 移动开发 > 详细

ios navigationController代码创建

时间:2016-12-24 20:14:02      阅读:244      评论:0      收藏:0      [点我收藏+]

标签: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代码创建

标签:uiwindow   window   make   root   按钮   创建   头文件   nav   文件   

原文地址:http://www.cnblogs.com/liuzhixin-123/p/6217968.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!