更改UINavigationController导航栏的颜色 [英] change the color of navigation bar of UINavigationController
本文介绍了更改UINavigationController导航栏的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图通过使用
self.navigationController.navigationBar.tintColor = [UIColor brownColor];
在下面给出的代码中但不起作用。
in the below given code but its not working.
#import "uitextviewAppDelegate.h"
#import "uitextviewViewController.h"
@implementation uitextviewAppDelegate
@synthesize window = _window;
@synthesize viewController = _viewController;
@synthesize navigationController = _navigationController;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[uitextviewViewController alloc] init];
UINavigationController *navigationController=[[UINavigationController alloc] init];
self.navigationController.navigationBar.tintColor = [UIColor brownColor];
[navigationController pushViewController:_viewController animated:YES];
[_window addSubview:navigationController.view];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
任何人都可以说出为什么它没有改变导航栏的颜色UINavigation Controller。
Can anyone tell why it is not changing the color of the navigation bar of the UINavigation Controller.
提前致谢。
推荐答案
看着这些两行:
UINavigationController *navigationController=[[UINavigationController alloc] init];
self.navigationController.navigationBar.tintColor = [UIColor brownColor];
第一个 navigationController
与<$连接的是什么c $ c> self.navigationController ?
据我所知,没什么。
您需要将 self.navigationController
分配给 navigationController
。
类似于:
self.navigationController = navigationController;
这篇关于更改UINavigationController导航栏的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文