1.BackButton的隐藏
self.navigationItem.hidesBackButton = YES;
2.给push进去的导航栏的backButton去掉标题,只留“<” 符号
UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc]init];
backButtonItem.title = @"";
self.navigationItem.backBarButtonItem = backButtonItem;
3.自定义导航栏按钮(右) 必须给btn设置UIButtonTypeCustom
UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[rightBtn setFrame:CGRectMake(0, 0, 60, 22)];
[rightBtn setTitle:@"下一页" forState:UIControlStateNormal];
[rightBtn setBackgroundColor:[UIColor redColor]];
[rightBtn addTarget:self action:@selector(rightBtnClick:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc]initWithCustomView:rightBtn];
self.navigationItem.rightBarButtonItem = rightButton;
4.导航控制器栏的背景颜色
self.navigationController.navigationBar.barTintColor = color;
5.导航栏自带按钮和按钮文字的颜色
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
6.设置导航控制器标题的颜色和字体大小等...(设置后,子控制器的标题都沿用改设置)
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor],NSForegroundColorAttributeName, [UIFont systemFontOfSize:a],NSFontAttributeName,nil];
[self.navigationController.navigationBar setTitleTextAttributes:attributes];
7.额外改变导航栏标题(越过tableItem控制器title)
self.navigationItem.title = @"CEO特训";
8.自带按钮(右)
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:nil action:@selector(rightBtn)];
NavigationController
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 1、navigationItemnavigation item在navigation Bar代表一个viewCon...
- //导航栏标题颜色/大小 [self.navigationController.navigationBar set...
- UI总结-导航控制器NavigationController 今天回顾了一下导航控制器NavigationCon...
- 链接地址:http://codecloud.net/15369.html iOS 仿nice首页的navigati...