Tab Bar Images not showing until after clicked
I have created 4 tabs without using Interface Builder (which I find makes things more complicated than they need to be). When I build & go, the simulator will show the first tab bar button image, but the other 3 won't show until after I have clicked them. All 4 tab bar images are custom images. How can I get them to all show from the start?
Here is the code from my MainViewController:
#import "MainViewController.h"
#import "ProofViewController.h"
#import "WhosWhoViewController.h"
#import "DebateViewController.h"
#import "LinksViewController.h"
@implementation MainViewController
@synthesize navigationController;
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"Main View Did Load: %@", self.tabBarItem.title);
if(self.tabBarItem.title == @"Proof") {
self.tabBarItem.image = [UIImage imageNamed:@"radar.png"];
ProofViewController *proofViewController = [[ProofViewController alloc] init];
[self pushViewController:proofViewController animated:YES];
[proofViewController release];
} else if (self.tabBarItem.title == @"Who's Who") {
self.tabBarItem.image = [UIImage imageNamed:@"runner.png"];
WhosWhoViewController *whosWhoViewController = [[WhosWhoViewController alloc] init];
[self pushViewController:whosWhoViewController animated:YES];
[whosWhoViewController release];
} else if (self.tabBarItem.title == @"Debate") {
self.tabBarItem.image = [UIImage imageNamed:@"chat2.png"];
DebateViewController *debateViewController = [[DebateViewController alloc] init];
[self pushViewController:debateViewController animated:YES];
[debateViewController release];
} else if (self.tabBarItem.title == @"Links") {
self.tabBarItem.image = [UIImage imageNamed:@"cloud.png"];
LinksViewController *linksViewController = [[LinksViewController alloc] init];
[self pushViewController:linksViewController animated:YES];
[linksViewController release];
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
}
- (void)dealloc {
[super dealloc];
[navigationController release];
}
@end
Many thanks!!
|