简体   繁体   English

UITabbarController与MoreNavigationController,PoptoRootViewController问题

[英]UITabbarController with MoreNavigationController , PoptoRootViewController issue

Kindly help me with this issue . 请帮我解决这个问题。

I am using tabbarcontroller in my App, 我在我的应用程序中使用tabbarcontroller,

[tabBarController setViewControllers:tabs]; [tabBarController setViewControllers:tabs]; tabs Contain array of viewcontrollers (6 viewcontrollers). 选项卡包含一组ViewController(6个ViewController)。

It automatically created more button. 它会自动创建更多按钮。

ISSUE 问题

When I open any viewcontroller from more button and then open any other controller from index 0 to 2 , and then press more button it maintain the last opened viewcontroller . 当我从more按钮打开任何viewcontroller,然后从索引0到2打开任何其他控制器,然后按more按钮时,它将保持最后打开的viewcontroller。

For Example: more button tableviewcontroller 例如:更多按钮tableviewcontroller

screen : 屏幕: 在此处输入图片说明

Now when i press Contacts let say 现在,当我按通讯录时,请说

在此处输入图片说明

Now when user press any other tabbar like feature tab bar 现在,当用户按下任何其他标签栏(例如功能标签栏)时

在此处输入图片说明

Now when user go back to more tab it shows the contact's viewcontroller 现在,当用户返回到更多选项卡时,它将显示联系人的视图控制器 在此处输入图片说明

But i want the app to poptorootviewcontroller when user back again to more tabbar , and simply more tableviewcontroller. 但是我希望应用程序在用户再次回到更多的tabbar和更多的tableviewcontroller时弹出poptorootviewcontroller。

在此处输入图片说明

You can do this by in the ViewWillDisappear method of view controller in More tab, call method to pop this view out of MoreViewNavigationController, like this: 您可以通过在“更多”选项卡中的视图控制器的ViewWillDisappear方法中执行此操作,调用该方法可将该视图从MoreViewNavigationController中弹出,如下所示:

- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self.navigationController popViewControllerAnimated:NO];
}

May be too late but here it is for future reference 可能为时已晚,但在这里供将来参考

UITabController has a tabBar property and it has a delegate which tells you when a tabitem is tapped UITabController具有tabBar属性,它具有一个委托,该委托告诉您何时点击tabitem

- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item 

Tab bar also has another property "items" which lists the visibile tabs. 标签栏还具有另一个属性“ items”,其中列出了可见的标签。 Find the index of the selected tab item in items in the delegate method implementation and if the index is 4 which is more button then call tab [controller.moreNavigationController popToRootViewController] 在委托方法实现中的项中找到所选选项卡项的索引,如果索引为4(是更多按钮),则调用选项卡[controller.moreNavigationController popToRootViewController]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM