UINavigationBarは、backgroundの値を変えても色を変えることができません。色を変えたい場合はtintColorの値を変更して下さい。この手法はiOS5.0以降で利用できます。
navCtr.navigationBar.tintColor = [UIColor redColor];
Empty Applicationから作る場合はこんな感じになります。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
UIViewController * viewCtr = [[UIViewController alloc] init];
UINavigationController * navCtr = [[UINavigationController alloc] initWithRootViewController:viewCtr];
self.window.rootViewController = navCtr;
viewCtr.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"info" style:UIBarButtonItemStylePlain target:nil action:nil];
navCtr.navigationBar.tintColor = [UIColor redColor];
[self.window makeKeyAndVisible];
return YES;
}
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];
UIViewController * viewCtr = [[UIViewController alloc] init];
UINavigationController * navCtr = [[UINavigationController alloc] initWithRootViewController:viewCtr];
self.window.rootViewController = navCtr;
viewCtr.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"info" style:UIBarButtonItemStylePlain target:nil action:nil];
navCtr.navigationBar.tintColor = [UIColor redColor];
[self.window makeKeyAndVisible];
return YES;
}
