我有UITabBarController(选项卡1)内的UINavigationController。当我进入第二个视图(仍在标签1中)时,如何使标签栏消失?我可以使用后退按钮导航,标签栏将重新出现。UITabBarController与UINavigationController
1
A
回答
4
self.hidesBottomBarWhenPushed = YES; 将此行放在您浏览的位置(在推送操作之前)。
and self.hidesBottomBarWhenPushed = NO; 在viewWillDisappear从您推其他视图的相同页面。
它确实有效。在-viewDidLoad
方法
self.hidesBottomBarWhenPushed = YES;
:
1
在的viewController被推,放。它属于'孩子'风险投资,而不是风险投资。你不需要在其他地方设置它。
0
我喜欢使用视图控制器的init方法来隐藏底部栏等等。使行为更好地封装。
(注:以下是ARC友好的代码,因此没有autorelease
来电或retain
/release
双。)
#pragma mark - UIViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
// We must handle this as it's the designated initializer for UIViewController.
// Pay no attention to the params. We're going to override them anyway.
return [self init];
}
#pragma mark - NSObject
- (id)init {
// Why hello there, superclass designated initializer! How are you?
if ((self = [super initWithNibName:@"YourNibNameHere" bundle:nil])) {
// This is a perfect oppy to set up a number of things, such as ...
// ... the title (since you're in a nav controller).
self.navigationItem.title = @"Your Nav Title";
// ... your bottom bar hiding (takes effect once pushed onto your nav controller).
self.hidesBottomBarWhenPushed = YES;
// ... and your tab bar item (since you're in a tab bar controller).
[self setTabBarItem:[[UITabBarItem alloc] initWithTitle:@"Item Title" image:[UIImage imageNamed:@"itemIcon.png"] tag:itemTag]];
}
return self;
}
现在,所有你需要做的就是alloc
/init
您的视图控制器,并呼吁-pushViewController:animated:
。没有麻烦,没有大惊小怪。
当VC弹出时,您的底栏将返回。 (Promise)
这项技术的信用归于Big Nerd Ranch的Joe Conway。 (这是我从中学到了这个了不起的模式的人。)
至于使用点符号与不是,那么,这是一个完全不同的讨论。因人而异。 ;)
相关问题
- 1. UINavigationController,rootViewController与UITabBarController
- 2. UINavigationController + UITabBarController + UISegmentedControl与TableView/MapView
- 3. ZUUIRevealController与UITabBarController而不是UINavigationController
- 4. Monotouch UITabBarController + UINavigationController
- 5. Uitabbarcontroller和uinavigationcontroller howto
- 6. 从UINavigationController推UITabBarController
- 7. 的UITabBarController和UINavigationController的
- 8. UITabBarController和UINavigationController交互
- 9. 的UITabBarController UINavigationController的中
- 10. 嵌入UINavigationController的UITabBarController
- 11. 将UITabBarController与UINavigationController结合使用
- 12. 将UINavigationController与UITabBarController结合使用
- 13. iphone应用程序与uinavigationcontroller和uitabbarcontroller
- 14. MonoTouch UITabBarController和UINavigationController标题
- 15. UISearchDisplayController,UINavigationController的,的UITabBarController愁楚
- 16. UITabBarController + UINavigationController问题xcode项目
- 17. UITabbarController关闭模式UINavigationController
- 18. 的Objective-C的UINavigationController +的UITabBarController
- 19. UITabBarController/UINavigationController旋转问题
- 20. UINavigationController中的UITabBarController的差距
- 21. 来自UITabBarController内的popView UINavigationController
- 22. UITabBarController里面的UINavigationController问题
- 23. UINavigationController和UITabBarController在Xcode 4中
- 24. iPhone UITabBarController里面的UINavigationController?
- 25. UITabBarController和UINavigationController的子类化
- 26. UITabBarController中的隐藏的UINavigationController
- 27. 如何通过UITabBarController中的另一个UINavigationController显示UINavigationController?
- 28. 在另一个UINavigationController中的UITabBarController中使用UINavigationController的问题
- 29. popToRoot UINavigationController当开关选项卡在UITabbarController
- 30. Objective C - 用动画隐藏UINavigationController&UITabBarController
谢谢。是自我的navcontroller? – Adele 2010-12-09 04:40:44