对于“在意外状态下完成导航转换”该怎么办。导航栏子视图树可能会损坏。”

发布于 2024-10-26 12:45:43 字数 602 浏览 9 评论 0原文

我正在使用 Appcelerator Titanium Mobile 编写 iPhone 应用程序。我根据焦点窗口隐藏和显示选项卡组。

dashWin.addEventListener("focus",function(e) {
    if (dashWin.tabGroupVisible == true) {
        dashWin.tabGroupVisible=false;
        tabGroup.animate({bottom:-50,duration:500});
    }
});

上面的代码在 dashWin 收到焦点事件时隐藏选项卡组。但是,当在 iPhone 模拟器中运行时触发事件时,我在 Titanium 控制台中看到此消息:

在意外状态下完成导航转换。导航栏子视图树可能会损坏。

Google 搜索会出现一个结果:另一个 StackOverflow 问题,可能会提示发生的情况在。

I'm writing an iPhone app using Appcelerator Titanium Mobile. I am hiding and showing the tab group based on what window has focus.

dashWin.addEventListener("focus",function(e) {
    if (dashWin.tabGroupVisible == true) {
        dashWin.tabGroupVisible=false;
        tabGroup.animate({bottom:-50,duration:500});
    }
});

The code above hides the tab group when dashWin receives a focus event. However, I see this message in the Titanium console when the event fires while running in the iPhone simulator:

Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.

A Google search turns up one result: Another StackOverflow question that may have a hint as to what's going on.

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

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

发布评论

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

评论(4

落花浅忆 2024-11-02 12:45:43

当我通过故事板将 Action SegueSelection Segue 从一个视图链接到另一个视图并再次以编程方式执行相同的 segue 时,出现此错误,这使得导航控制器执行相同的操作继续两次。

针对这种情况的 2 个解决方案:

  1. 删除推送视图的代码。只需让故事板为您执行转场即可。这对于大多数情况来说都很好。
  2. 手动部分替换Action SegueSelection Segue并执行- (void)performSegueWithIdentifier:(NSString *)identifier sender:(id )由您自己发送。当您想要根据发件人自定义 segue 的行为时,您可能会发现此解决方案很有用。

I got this error when I linked Action Segue or Selection Segue from one view to another view through storyboard and performed the same segue programmatically again, which makes the navigation controller perform the same segue twice.

2 solutions for this case:

  1. Removing the code that pushes the view. Just let storyboard perform the segue for you. This is good for most situations.
  2. Replacing Action Segue or Selection Segue with Manual Section and do - (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender by yourself. You may find this solution useful when you want to customize the behavior of segue according to the sender.
鲸落 2024-11-02 12:45:43

通常,选项卡组充当应用程序导航的根。当用户点击选项卡时,该选项卡的窗口将获得焦点。

接下来,当用户触发需要出现新窗口的操作时,它通常会以模态方式出现或出现在当前窗口的顶部(在导航堆栈意义上)。在后一种情况下,告诉当前选项卡打开新窗口。

如果将 tabBarHidden 属性设置为 false(创建新窗口时),则当当前选项卡打开新窗口时,选项卡栏将为您隐藏。

这种更标准的方法对您有用吗?

Usually a tab group acts as the root of your app's navigation. When a user taps a tab, that tab's window is focused.

Next, when a user triggers an action that requires a new window appear, it usually appears either modally or on top (in the navigation stack sense) of the current window. In the latter case, tell the current tab to open the new window.

If you set the tabBarHidden property to false (when you create the new window), the tab bar will be hidden for you when the new window is opened by the current tab.

Will this more standard approach work for you?

假面具 2024-11-02 12:45:43

我有 segues 导致回到我的主导航控制器,这导致了这个问题。我通过将主导航控制器设置回堆栈顶部来解决该问题。这是代码:

- (void) viewDidAppear:(BOOL)animated
{
    [self.navigationController popToRootViewControllerAnimated:NO];
}

I had segues that were leading back to my main navigation controller which was causing this. I fixed the problem by setting the main navigation controller back to the top of the stack. Here is the code:

- (void) viewDidAppear:(BOOL)animated
{
    [self.navigationController popToRootViewControllerAnimated:NO];
}
美羊羊 2024-11-02 12:45:43

最近,我遇到了同样的问题。原因是:
-我试图错误地弹出视图控制器两次。
您可以通过在推送和弹出视图控制器上设置断点来检查此崩溃

Recently, I've faced the same problem. The reason was:
-I was trying to pop view controller twice by mistake.
you can check this crash by setting breakpoints on push and pop View controllers

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文