【发布时间】:2014-12-17 14:28:23
【问题描述】:
我需要在我的视图控制器上将标签栏位置更改为顶部,我发现了如何做到这一点。问题是现在在其中一个选项卡中我需要推送一个新的视图控制器,但是当我这样做时,导航栏不会出现。我尝试将新的视图控制器嵌入到另一个导航控制器中并且它可以工作(显示导航栏)但它没有显示后退按钮项。有没有办法做到这一点?
这里有一些屏幕截图:
这就是我在标签之间导航的方式
- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {
switch (item.tag) {
case 1:
if (Home == nil) {
UIStoryboard* sb = [UIStoryboard storyboardWithName:@"Main"
bundle:nil];
Home = [sb instantiateViewControllerWithIdentifier:@"Home"];
}
[self.view insertSubview:Home.view belowSubview:mainTabBar];
break;
case 2:
if (Activity == nil) {
UIStoryboard* sb = [UIStoryboard storyboardWithName:@"Main"
bundle:nil];
Activity = [sb instantiateViewControllerWithIdentifier:@"Activity"];
}
[self.view insertSubview:Activity.view belowSubview:mainTabBar];
break;
case 3:
if (Discover == nil) {
UIStoryboard* sb = [UIStoryboard storyboardWithName:@"Main"
bundle:nil];
Discover = [sb instantiateViewControllerWithIdentifier:@"Discover"];
}
[self.view insertSubview:Discover.view belowSubview:mainTabBar];
break;
case 4:
if (Profile == nil) {
UIStoryboard* sb = [UIStoryboard storyboardWithName:@"Main"
bundle:nil];
Profile = [sb instantiateViewControllerWithIdentifier:@"Profile"];
}
[self.view insertSubview:Profile.view belowSubview:mainTabBar];
break;
default:
break;
}
这是我需要推送的视图控制器。
【问题讨论】:
标签: ios objective-c iphone uinavigationcontroller uitabbarcontroller