I am trying to set the icons of a UITabBarItem, but it is not working. By the way, I'm using Xcode 5 Beta for this project.
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
{
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];
UIImage *tabBarBackground = [UIImage imageNamed:@"tabbar.png"];
[[UITabBar appearance] setBackgroundImage:tabBarBackground];
[[UITabBar appearance] setSelectionIndicatorImage:[UIImage imageNamed:@"tabbar_selected.png"]];
[[UITabBar appearance] setTintColor:[UIColor whiteColor]];
}
return YES;
}
I am trying to get the icons to be white when both selected and unselected, but they are remaining gray in the unselected state.
Edit
I tried doing this, but now im getting the error "Expression Result Unused"
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UITabBar *tabBar = tabBarController.tabBar;
UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0];
tabBarItem1.title = @"Home";
UIImage *graph = [UIImage imageNamed:@"graph.png"];
[tabBarItem1 initWithTitle:(NSString *)@"HELLO" image:(UIImage *)graph selectedImage:(UIImage *)graph];