I'm developing an iOS 4 app using latest SDK and Xcode 4.2.
I've added programmatically a UINavigationController on AppDelegate, and I set it black.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
viewController.title = @"Menu";
navController = [[UINavigationController alloc] initWithRootViewController:viewController];
navController.navigationBar.tintColor = [UIColor blackColor];
self.window.rootViewController = navController;
[self.window makeKeyAndVisible];
return YES;
}
On one view controller, I've added a UISegmentedControl:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
// Do any additional setup after loading the view from its nib.
segmentedControl = [[UISegmentedControl alloc] initWithItems:
[NSArray arrayWithObjects:
[NSString stringWithString:@"Past"],
[NSString stringWithString:@"Present"],
[NSString stringWithString:@"Future"],
nil]];
[segmentedControl addTarget:self action:@selector(segmentedChanged:) forControlEvents:UIControlEventValueChanged];
segmentedControl.frame = CGRectMake(0, 0, 260, 30);
segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
segmentedControl.selectedSegmentIndex = 0;
self.navigationItem.titleView = segmentedControl;
}
But, when I set one item selected, I can see it because is black.
Is there anyway to set to another color when a item is selected?