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

iOS navigationbar添加实现

时间:2014-10-20 02:02:53      阅读:212      评论:0      收藏:0      [点我收藏+]

标签:io   os   ar   sp   on   cti   ad   ef   bs   

#ViewController.m

 

- (void)viewWillAppear:(BOOL)animated{

    [super viewWillAppear:animated];

    UIViewController *rootView = [[UIViewController alloc] init];

    rootView.title = @"Root View";

    self.navController = [[UINavigationController alloc] init];

    [self.navController pushViewController:rootView animated:YES];

    [self.view addSubview:self.navController.view];

    self.navigationController.navigationBarHidden = YES;

    UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(selectLeftAction:)];

    leftButton.title = @"123";

    rootView.navigationItem.leftBarButtonItem = leftButton;

    UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd  target:self action:@selector(selectRightAction:)];

    rootView.navigationItem.rightBarButtonItem = rightButton;

}

iOS navigationbar添加实现

标签:io   os   ar   sp   on   cti   ad   ef   bs   

原文地址:http://www.cnblogs.com/i0ject/p/4036294.html

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