在IOS7你可以试试这个:
[[UINavigationBar appearance] setBarTintColor:[UIColor redColor]];
您可以按照以下步骤操作:
我创建了一个新UINavigationController
的例子UIDemoNavController
,结果是:
- (void)viewDidLoad{
[[UINavigationBar appearance] setBarTintColor:[UIColor redColor]];
[super viewDidLoad];
}
这是完整的演示课程:
#import "UIDemoNavController.h"
@interface UIDemoNavController()
@end
@implementation UIDemoNavController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {}
return self;
}
- (void)viewDidLoad{
[[UINavigationBar appearance] setBarTintColor:[UIColor redColor]];
[super viewDidLoad];
}
- (void)didReceiveMemoryWarning{
[super didReceiveMemoryWarning];
}
@end