私のAppDelegateには、次のコードがあります。
UIViewController *viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
UINavigationController *itemsNavigationController1 = [[UINavigationController alloc] initWithRootViewController:viewController1];
UIVNagigationBarの背景色を緑に設定するにはどうすればよいですか?
私が行った場合:
[self.navigationController.navigationBar setTintColor:[UIColor greenColor]];
viewController1からは、これは効果がありません。
前もって感謝します!
アップデート:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = NSLocalizedString(@"MyTitle", @"");
[self.navigationController.navigationBar setTintColor:[UIColor greenColor]];
[self.parentViewController.navigationController.navigationBar setTintColor:[UIColor greenColor]];
}
return self;
}
どちらも効果はありません