I have put one global tabBarController in iphone app that I have been working on.
But in one of my screen I needed to put the local tabBar which is different from the global tabBarController.
I have done it in two ways:
1) Hiding the global tabBar by self.tabBarController.tabBar.hidden = yes; and putting local tabBar in place of it in the view. But the frame of tabBar is showing blank white.
2) Tried by adding the local tabBar as subview of global tabBar which worked but after screen is unloaded its not removing the local tabBar though applying [localTabBar removeFromSuperView];
Thanks in advance..
Global tabBarController:
tabBarController = [[UITabBarController alloc] init];
tabBarController.viewControllers = [NSArray arrayWithObjects:ActivityTabnav,nav2,privateChatnav,ExploreTabnav,nav3,tempTabnav, nil];
localtabBar is a tabBar on view xib of viewController.
in vIewDidLoad >
UIWindow* window = [[UIApplication sharedApplication] keyWindow];
[window addSubview:self.tabBar];
in vIewDidUnLoad >
[self.tabBar removeFromSuperview];
Previously I tried to add self.tabBar to self.tabBarController.tabBar as a subView which persisted the local self.tabBar in other screens.
Thank you…
The cleanest way I’ve found to do this is to set the
hidesBottomBarWhenPushedproperty of your view controller, then place it inside aUINavigationController(hiding the navigiationBar if you don’t need it). This will hide theUITabBarController'sUITabBarwithout leaving a white space.You’d then put the local
UITabBardirectly into theUIViewController'sview;Another possibility would be to hide the
UITabBarController'sUITabBar, then add the localUITabBarto as a subview ofUITabBarController'sview. Of course you’d have to remove from superview when needed.