hi
i am making a simple tab bar based application.
i have taken the view based application and int the view controller class i have the following code to add three tabs
Code:
- (void)viewDidLoad {
[super viewDidLoad];
UINavigationController *localNavigationController;
NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:3];
tabBarController = [[UITabBarController alloc] initWithNibName:@"TabbedViewController" bundle:nil];
tabBarController.delegate=self;
FirstTabController *_firstTab = [[FirstTabController alloc] initWithNibName:@"FirstTabController" bundle:nil];
localNavigationController = [[UINavigationController alloc] initWithRootViewController:_firstTab];
localNavigationController.navigationBar.topItem.title = @"First View";
localNavigationController.navigationBar.tintColor=[UIColor blackColor];
//setting image and title for the first tab
UITabBarItem *tabBarItem1 = [[UITabBarItem alloc] initWithTitle: @"SCHEDULE" image:[UIImage imageNamed: @"images0.png"] tag:0];
localNavigationController.tabBarItem = tabBarItem1;
[tabBarItem1 release];
[localControllersArray addObject:localNavigationController];
SecondTabController *_secondTab = [[SecondTabController alloc] initWithNibName:@"SecondTabController" bundle:nil];
localNavigationController = [[UINavigationController alloc] initWithRootViewController:_secondTab];
localNavigationController.navigationBar.topItem.title = @"Second View";
localNavigationController.navigationBar.tintColor=[UIColor blackColor];
//setting image and title for the second tab
UITabBarItem *tabBarItem2 = [[UITabBarItem alloc] initWithTitle: @"UPCOMING" image:[UIImage imageNamed: @"images1.png"] tag:1];
localNavigationController.tabBarItem = tabBarItem2;
[tabBarItem2 release];
[localControllersArray addObject:localNavigationController];
ThirdTabController *_thirdTab = [[ThirdTabController alloc] initWithNibName:@"ThirdTabController" bundle:nil];
localNavigationController = [[UINavigationController alloc] initWithRootViewController:_thirdTab];
localNavigationController.navigationBar.topItem.title = @"Third View";
localNavigationController.navigationBar.tintColor=[UIColor blackColor];
//setting image and title for the third tab
UITabBarItem *tabBarItem3 = [[UITabBarItem alloc] initWithTitle: @"RECENT" image:[UIImage imageNamed: @"images1.png"] tag:2];
localNavigationController.tabBarItem = tabBarItem3;
[tabBarItem3 release];
[localControllersArray addObject:localNavigationController];
tabBarController.viewControllers = localControllersArray;
//self.navigationController.navigationBar.tintColor=[UIColor colorWithRed:0.0/255 green:113.0/255 blue:0.0/255 alpha:1.0];
[localControllersArray release];
self.view = tabBarController.view;
tabBarController.delegate = self;
}
when i click on the tabs first time view did load is called but when i click on them after that that is for second or third time neither view did load nor view will appear is called.
i have to use table view in the third tab and i want to reload the data when i click on it that mean i want view will appear to be called somehow.
please let me know how to do this.
thanks