标签栏有问题,导航到该页面时不显示标签栏
在我的测试项目中,我有一些 5 个选项卡,单击某个选项卡,它将转到相应的类,单击该屏幕中的返回,我将返回到我的主页,但没有选项卡栏。之前的 5 个选项卡是什么那些不会来......
下面的代码我在后退按钮下使用 其中 DataEntry
是我需要导航的类,
- (void) back_Clicked:(id)sender
{
DataEntry *avController;
UINavigationController *addNavigationController;
if(avController == nil)
avController = [[DataEntry alloc] initWithTabBar];
if(addNavigationController == nil)
addNavigationController = [[UINavigationController alloc] initWithRootViewController:avController];
[self. navigationController presentModalViewController:addNavigationController animated:YES];
}
我是否必须将该导航控制器添加到选项卡视图?我怎样才能在点击后退时获得标签栏任何人都可以帮助我,提前谢谢
In my test project I have some 5 tabs on click of a tab it will go to that corresponding class, on click of back in that screen I will come back to my home page but with out the tab bar.. earlier what 5 tabs were there those are not coming ...
following code I am using under back button
where DataEntry
is the class to where i need to navigate
- (void) back_Clicked:(id)sender
{
DataEntry *avController;
UINavigationController *addNavigationController;
if(avController == nil)
avController = [[DataEntry alloc] initWithTabBar];
if(addNavigationController == nil)
addNavigationController = [[UINavigationController alloc] initWithRootViewController:avController];
[self. navigationController presentModalViewController:addNavigationController animated:YES];
}
is I have to add that navigation controller to the tab view? how can I get the tab bar on click of back can any one help me ,thanx in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我了解,您必须已经通过导航控制器或模态推送此视图控制器。所以我们的想法就是简单地驳回它,对吗?
如果您使用过
[self.navigationController PushViewController:animated:]
那么只需执行[self.navigationController popViewControllerAnimated:YES];
。这应该带您回到之前的视图控制器。如果您像此处那样以模态方式呈现此内容,则应该执行
[self.navigationController DismissModalViewControllerAnimated:YES];
。As I understand this, you must already be pushing this view controller either via navigation controller or modally. So the idea would be to simply dismiss it right?
If you have used
[self.navigationController pushViewController:animated:]
then just do[self.navigationController popViewControllerAnimated:YES];
. This should take you back to the earlier view controller.If you have presented this modally like you have done here, you should do
[self.navigationController dismissModalViewControllerAnimated:YES];
.如果您需要使用选项卡视图内的后退按钮从视图返回到上一个视图,我建议您在需要此功能的每个选项卡的视图内使用导航控制器。在我看来,尝试在不使用导航控制器的情况下实现自定义后退按钮只会让事情变得困难。
如果您只想在点击选项卡栏按钮时显示一个视图,那么选项卡栏视图内的普通视图控制器就足够了。
标签栏不应该完全消失,除非它的实现不正确。
If you need to return back from a view to the previous view using a back button inside a tab view , i would recommend using a navigation controller inside the view for each tab where you require this functionality. Trying to implement a custom back button without using the navigation controller, in my opinion, is only making things tough for yourself.
If you only want one view to be displayed when you tap on a tab bar button then an ordinary view controller inside the tab bar view should suffice.
The tab bar shouldnt be disappearing altogether unless its been implemented incorrectly.