首页 > 其他 > 详细

UINavigationController的navigationBar的常用设置(按钮,标题,颜色)

时间:2015-05-11 17:56:29      阅读:211      评论:0      收藏:0      [点我收藏+]

http://blog.csdn.net/u010229677白白手游专栏

使用:

    ViewController* vc = [[ViewController alloc] init];    
    self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:vc];
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];


切换:

[self.navigationController pushViewController:xxx animated:YES];

[self.navigationController popViewControllerAnimated:YES];

    self.title = @"标题";    
    //设置背景颜色,下面三句话
    self.navigationController.navigationBar.backgroundColor = [UIColor blueColor];
    self.navigationController.navigationBar.translucent = YES; //设置背景为透明的
    self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
    
    self.navigationController.navigationBar.tintColor = [UIColor blueColor]; //设置按钮颜色
    //手动添加左右两个按钮,若不添加,左按钮自动生成,带有返回图标和上一个界面的标题
    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Exit" style:UIBarButtonItemStylePlain target:self action:@selector(handleExit:)];
    self.navigationItem.leftBarButtonItem = backButton;
    UIBarButtonItem *setButton = [[UIBarButtonItem alloc] initWithTitle:@"设置" style:UIBarButtonItemStylePlain target:self action:@selector(setButtonAction:)];
    self.navigationItem.rightBarButtonItem = setButton;


UINavigationController的navigationBar的常用设置(按钮,标题,颜色)

原文:http://blog.csdn.net/u010229677/article/details/45645869

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