如何使用向下钻取表视图重置 tabcontoller

发布于 2024-08-25 13:52:46 字数 280 浏览 3 评论 0原文

我有一个选项卡栏,其中一个选项卡包含向下钻取表。

用户完成使用钻取表后,我遇到问题。

如果它们更改为另一个选项卡,然后更改回原始选项卡,原始选项卡仍位于我离开的位置(在显示详细视图的向下钻取的底部)。

我想要的是移动到旧选项卡重置的替代选项卡。

我尝试向 -(void)viewDidDisappear-(void)viewDidUnload 添加各种内容,但没有成功。

我需要做什么?

干杯

I have a tabbar with one of the tabs containing a drilldown table.

I am having problems once the user has finished using the drilldown table.

If they change to another tab, then change back to the original tab, the original tab is still where I left it (at the bottom of the drill down showing the detail view).

What I want is on moving to an alternative tab the old tab resets.

I have tried adding all sorts of stuff to -(void)viewDidDisappear and -(void)viewDidUnload with no success.

What do I need to do?

Cheers

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

命比纸薄 2024-09-01 13:52:46

据我了解您的问题,每当您浏览选项卡时,您都希望每个选项卡上都有第一个视图。您不希望在您离开的地方显示旧视图。
这是仅在您的 appdelegate 文件中使用的代码:

(void)tabBarController:(UITabBarController *)tabBarController1 didSelectViewController:(UIViewController *)viewController{
    NSArray *vc= tabBarController1.viewControllers;
    for (int i = 0; i < [vc count]; i++) {
        UINavigationController *nc = [vc objectAtIndex:i];
        if (nc == tabBarController1.selectedViewController) {
            continue;
        }
        [nc popToRootViewControllerAnimated:NO];
    }   
}

As I understood your question, you want the first view on every tab, whenever you move through tabs. You don't want the old view to be displayed there which you had left.
Here is the code just use that in your appdelegate file:

(void)tabBarController:(UITabBarController *)tabBarController1 didSelectViewController:(UIViewController *)viewController{
    NSArray *vc= tabBarController1.viewControllers;
    for (int i = 0; i < [vc count]; i++) {
        UINavigationController *nc = [vc objectAtIndex:i];
        if (nc == tabBarController1.selectedViewController) {
            continue;
        }
        [nc popToRootViewControllerAnimated:NO];
    }   
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文