gpt4 book ai didi

iphone - 将焦点设置为 UITabBarItem

转载 作者:行者123 更新时间:2023-12-01 18:31:14 28 4
gpt4 key购买 nike

我有一个 UITabBarController里面有几个标签栏项目。第一个标签栏项目有一个名为 A 的 View 。它有一个名为 Click 的按钮.当我单击该按钮时, View 将导航到另一个 View 。 (因为这个标签有一个 UINavigationController View 会得到一个返回按钮)。

现在这个 View 将有一个按钮,当我点击它时,我应该导航到第二个 TabItem。 (意味着 UITabBarItem 应该设置焦点,并且不应该有返回按钮(如在导航 Controller 中))

笔记 :

当用户单击按钮时,我使用以下代码导航到另一个 UITabBarItem 的另一个 View 。然后第二个标签栏项目没有设置为焦点,并且还可以看到导航 Controller 的后退按钮。

SelectSiteViewController *siteViewController =
[[SelectSiteViewController alloc] initWithNibName:@"SelectSiteViewController"
bundle:nil];
[self.navigationController pushViewController:siteViewController
animated:YES];

希望我把我的问题说清楚了。我该如何编码?

最佳答案

据我了解,您想从导航任务中删除当前 View Controller 并选择选项卡栏 Controller 中的第二个选项卡。

UINavigationController *navigationController = self.navigationController;
[navigationController popToRootViewControllerAnimated:NO];
[navigationController.tabBarController setSelectedIndex:1];

关于iphone - 将焦点设置为 UITabBarItem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8546221/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com