我已经使用Storyboard构建了我的应用程序。我有一个UITabBarController和一个NavigationController嵌入它。 我想用色调自定义我的应用程序,并设法为Tabbar设置自定义颜色。我能够访问rootViewController中的tabbar,但是我无法访问导航栏。无论如何,我可以轻松访问这个? 我的AppDelegate代码示例如下。iOS - AppDelegate中的访问导航控制器
感谢
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions
{
self.tabBarController = (UITabBarController*)self.window.rootViewController;
UITabBar *tabBar = self.tabBarController.tabBar;
[tabBar setSelectedImageTintColor:[UIColor greenColor]];
tabBar.tintColor = [UIColor colorWithRed:0.4 green:0.522 blue:0.129 alpha:1];
//This bit doesnt work
UINavigationController *navCon = self.tabBarController.navigationController;
navCon.navigationBar.tintColor = [UIColor colorWithRed:0.384 green:0.259 blue:0.161 alpha:1];
return YES;
}
完美。非常感谢 – 2012-04-03 23:04:42