[英]Displaying a UITabBar when pushing to a UIViewController
I am working on a new project of mine and am looking for what the best solution to keep the UITabBarController
displaying even when using a segue
to push to a UIViewController
. 我正在研究我的一个新项目,即使在使用
segue
推送到UIViewController
时,也在寻找什么最佳的解决方案来保持UITabBarController
显示。
Currently I have an Initiation
of our UITabBarController
on app launch, which contains multiple
viewcontroller
relationships
. 目前,我有一个
Initiation
我们UITabBarController
在应用程序启动,它包含multiple
viewcontroller
relationships
。 Particularly the initial view controller
option is a custom UIViewController
which implements a UITableView
. 特别是,
initial view controller
选项是实现UITableView
的自定义UIViewController
。 Once a cell
is selected I call a show(push) segue
to another UIViewController
. 一旦选择了
cell
,我show(push) segue
调用到另一个UIViewController
。 This is where I lose my TabBar
which is as expected. 这是我丢失我的
TabBar
,正如预期的那样。 Now I have tried different approaches such as setting the hidden
value of our tabbar
to YES
, but does not seem to help. 现在,我尝试了其他方法,例如将
tabbar
的hidden
值设置为YES
,但似乎无济于事。
Code
When Cell Selected: 选择单元格时:
[self performSegueWithIdentifier: @"tableCellOptions" sender: self];
When preparing for segue
: 准备
segue
:
if([segue.identifier isEqualToString:@"tableCellOptions"]) {
additionUITableView *move = (additionUITableView *) segue.destinationViewController;
move.thisOption = [menuOptions objectAtIndex:cellPushed];
}
What would your approach be to this and why? 您对此将采取什么方法,为什么?
If you have Tab bar controller as the initial View Controller, the tab bar will show by default on each view controller. 如果您具有选项卡栏控制器作为初始View Controller,则默认情况下,选项卡栏将在每个视图控制器上显示。 If you are using storyboard or xib file, then select the tab bar item in view controller and check its properties, and make sure "hide tab bar on push" is unchecked.
如果您使用情节提要或Xib文件,请在视图控制器中选择选项卡栏项并检查其属性,并确保未选中“推送时隐藏选项卡栏”。
Programmatically you can do this, 您可以通过编程方式执行此操作
self.hidesBottomBarWhenPushed = NO;
[self.navigationController pushViewController:viewControllerToPush animated:YES];
Place it in viewDidLoad or viewDidAppear. 将其放在viewDidLoad或viewDidAppear中。
I hope this solves your problem. 我希望这能解决您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.