首页 > 移动平台 > 详细

ios navigationController代码创建

时间:2016-12-24 20:10:49      阅读:241      评论:0      收藏:0      [点我收藏+]

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!