iOS7之后. 默认的返回按钮字体颜色是蓝色的, 显示内如是父VC(上一级界面)的title
如果要做修改, 可以通过下面的办法:
- 修改字体颜色
(1) 在plist里面, 加上View controller-based status bar appearance, 并且设置为NO
(2) 在需要修改的那个界面. 加入如下代码(加在viewDIdLoad即可)
self.navigationController.navigationBar.barStyle = UIStatusBarStyleDefault;
[self.navigationController.navigationBar setTintColor:[UIColor greenColor]];
或:
//Nav样式
application.statusBarStyle = UIStatusBarStyleLightContent;
[UINavigationBar appearance].barTintColor =[UIColor colorWithRed:24/255.0 green:30/255.0 blue:43/255.0 alpha:1.0];
[UINavigationBar appearance].tintColor = [UIColor whiteColor];
NSDictionary *NavTextAttribute = @{
//字体颜色
NSForegroundColorAttributeName:[UIColor whiteColor],
//字体大小
NSFontAttributeName:[UIFont boldSystemFontOfSize:18]};
[UINavigationBar appearance].titleTextAttributes = NavTextAttribute;
2.更改UINavgation的navigationItem返回ButtonItem文字
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] init];
backItem.title = @"返回";
self.navigationItem.backBarButtonItem = backItem;
时间: 2024-10-06 20:58:01