在用作 popViewcontroller 的 UItabbarcontroller 中点击选定的 Tab

Tapping selected Tab in UItabbarcontroller working as a popViewcontroller

在我的应用程序中,我将 UITabbarcontroller 作为模态视图控制器呈现。有 3 个选项卡,我为每个选项卡分配了一个 UInavigationcontroller。 现在的问题是,如果我正在点击一个已经选择的选项卡,它作为 UInavigationcontroller 的 popViewControllerAnimated 函数工作。

UITabBarController *custom = [[UITabBarController alloc] init];
custom.delegate = self;
custom.tabBar.backgroundImage = [UIImage imageNamed:@"footerbar.png"];
[custom setViewControllers:[NSArray arrayWithObjects:nav, nav1, nav2, nil]];
[[UITabBar appearance] setItemWidth:(self.view.frame.size.width/3)-15];
[[NSUserDefaults standardUserDefaults] setObject:@"yes" forKey:@"loggedIn"];
[self presentViewController:custom animated:NO completion:nil];

我现在真的卡住了。 在这里需要建议。

这是 UITabBarController 行为,要防止出现这种情况,请检查 link

Prevent automatic popToRootViewController on double-tap of UITabBarController