Hi
In my app, i am having tabBarController , whose view is added to window's subview.
CODE is like as follows...
Here in one of my controller , i am having a button added to its view.
On clicking that button i want to re arrange the tabBar
For eg: If user touch that Button, my tabBar should contains only two items, say second View Controller and thirdViewController.
I tried it with setting viewControllers of the tabBarController
On click of Buttoon in firstViewController... i will call as follows
Following is the method which i call ....
The thing is that it is working and removing teh old tabBar with new one... But teh new one is not responding....
In my app, i am having tabBarController , whose view is added to window's subview.
CODE is like as follows...
Code:
FirstViewController *first = [[FirstViewController alloc]init];
SecondViewController *second = [[SecondViewController alloc]init];
ThirdViewController *third = [[ThirdViewController alloc]init];
UINavigationController *nav1 = [[UINavigationController alloc]initWithRootViewController:first];
UINavigationController *nav2 = [[UINavigationController alloc]initWithRootViewController:second];
UINavigationController *nav3 = [[UINavigationController alloc]initWithRootViewController:third];
[first release];
[second release];
[third release];
tabBarController = [[UITabBarController alloc]init];
[tabBarController setViewControllers:[NSArray arrayWithObjects:nav1,nav2,nav3,nil] animated:YES];
[nav1 release];
[nav2 release];
[nav3 release];
[window addSubview:[tabBarController view]];
[window makeKeyAndVisible];
Here in one of my controller , i am having a button added to its view.
On clicking that button i want to re arrange the tabBar
For eg: If user touch that Button, my tabBar should contains only two items, say second View Controller and thirdViewController.
I tried it with setting viewControllers of the tabBarController
On click of Buttoon in firstViewController... i will call as follows
Code:
sampleTabBarAppDelegate *sample = [[UIApplication sharedApplication] delegate];
[sample changeStyleToTwoItems];
Following is the method which i call ....
Code:
-(void)changeStyleToTwoItems
{
SecondViewController *second = [[SecondViewController alloc]init];
ThirdViewController *third = [[ThirdViewController alloc]init];
UINavigationController *nav2 = [[UINavigationController alloc]initWithRootViewController:second];
UINavigationController *nav3 = [[UINavigationController alloc]initWithRootViewController:third];
[second release];
[third release];
tabBarController = [[UITabBarController alloc]init];
[tabBarController setViewControllers:[NSArray arrayWithObjects:nav2,nav3,nil] animated:YES];
[nav2 release];
[nav3 release];
[window addSubview:[tabBarController view]];
[window makeKeyAndVisible];
}
The thing is that it is working and removing teh old tabBar with new one... But teh new one is not responding....