views:

89

answers:

1

Hi Guys

I am finding the solution for my application. I create an iphone application have 3 screen: First screen not contain any tab bar. Second screen have 2 tab bar item. Third screen have 3 tab bar item. http://c.upanh.com/upload/7/719/L50.11932623_1_1.jpg

  • If i create a UITabBarController -> the tab bar will be appeared from first screen. So I have to hide tab bar in first screen. But second and third screen have different tab bar -> not good idea.

Do you have solution for this issue, please help me.

Thank you !!!

A: 

I think that you can add and remove the tab in UITabBarController at runtime. This site is good for reading: UITabBarController

Some sample code for removing tabs from tab bar:

- (IBAction)processUserInformation:(id)sender

{

   // Call some app-specific method to validate the user data.

   // If the custom method returns YES, remove the tab.

   if ([self userDataIsValid])

   {

      NSMutableArray* newArray = [NSMutableArray arrayWithArray:self.tabBarController.viewControllers];

      [newArray removeObject:self];



      [self.tabBarController setViewControllers:newArray animated:YES];

   }

}
vodkhang
thank you, that useful for me. I can create difference tab Bar item in other View. Can I ask more. How can i setup "Goto TabBar1" button in first View to switch to second screen? (easy to switch from UIView to UIView. But I don't know how to switch from UIVIew to UITabBarController)
haicnpmk44
What do you mean when saying first View and second screen. Is this inside the same UITabBarController or in different ones?
vodkhang
Because in my first screen there is not Tab bar item so I want to create UITabBarController from second screen. And first screen is UIView. When I click button (in first screen) it will switch to second screen (contain Tab Bar). That is only my thinking. Or do you have other way to do it, please tell me!
haicnpmk44
Which class holds the first screen? If it is UIViewController, it should have a method call : [self.navigationController pushViewController:secondViewControllerHere withAnimated:YES]. This method will push the second View on top of the first View and when the second view appears, it will have the UITabBarController
vodkhang