我已經把我一直在iphone應用程序中的一個全局tabBarController。 但是在我的一個屏幕中,我需要放置與全局tabBarController不同的本地tabBar。把本地tabBar放在全局tabBar(我有一個全局tabBarController)
我已經做了兩種方式: 1)通過self.tabBarController.tabBar.hidden隱藏全局tabBar;是;並在視圖中放置局部tabBar。但tabBar的框架顯示空白。 2)試圖通過添加本地tabBar作爲全局tabBar子視圖工作,但在屏幕後卸載它不刪除本地tabBar雖然應用[localTabBar removeFromSuperView];
預先感謝..
Global tabBarController:
tabBarController = [[UITabBarController alloc] init];
tabBarController.viewControllers = [NSArray arrayWithObjects:ActivityTabnav,nav2,privateChatnav,ExploreTabnav,nav3,tempTabnav, nil];
localtabBar是上視圖的viewController的XIB一個的TabBar。在viewDidLoad中 >
UIWindow* window = [[UIApplication sharedApplication] keyWindow];
[window addSubview:self.tabBar];
在vIewDidUnLoad
>
[self.tabBar removeFromSuperview];
以前我試過self.tabBar添加到self.tabBarController.tabBar作爲堅持其他屏幕的地方self.tabBar子視圖。
謝謝...
恐怕我做到了。設置hidesBottomBarWhenPushed屬性工作,但在屏幕被卸載後localTabBar是persister,雖然它被從superview中刪除。我已經完成將localtabBar設置爲全局tabBar和tabBarController視圖的子視圖。 – Dinesh 2012-01-12 10:16:17
嗨嗨,謝謝大家..在viewController的初始化函數設置hidesBottomBarWhenPushed全局tabBar做了訣竅。 – Dinesh 2012-01-12 10:33:34