popToRootViewController 时出现奇怪的错误

发布于 2024-08-19 12:13:00 字数 947 浏览 0 评论 0 原文

我有一个基于导航的应用程序,我可以通过一些视图控制器进行导航。 此时我有 2 个视图控制器。在第二个视图控制器中,我有一个条件,如果为真,我会使用 popToRooViewController 弹出到第一个视图控制器。当我执行此操作时,应用程序返回到 rootController 但在调试器控制台中出现以下内容:

**-[UIWindow endDisablingInterfaceAutorotation] 在 >不匹配 -beginDisablingInterfaceAutorotation。忽略。 响应 SpringBoard 的终止而终止。**

我不知道为什么会发生这种情况。

我将项目创建为基于导航的应用程序。在 mainWindow.xib 中,它具有 navigationController,作为子视图,它具有导航栏和 rootviewcontroller。

然后在 rootViewController 中我更改为 viewController 而不是 tableviewcontroller。 第二个视图控制器也是一个视图控制器。

这是我调用根控制器时的代码。

else if (emptyTasks == YES && returnAddTask == NO)
{
    [self.navigationController popToRootViewControllerAnimated:YES]; // "Pushing the controller on the screen" 

    returnAddTask = YES;
}

感谢您的帮助!! :)

I have an Navigation-based app where i navigate trough some viewcontroller's.
At this moment I have 2 viewcontrollers. In the second viewcontroller, i have a condition that if it's true i pop to the first viewcontroller with popToRooViewController. When I do this the app return's to the rootController but in debugger console appears this :

**-[UIWindow endDisablingInterfaceAutorotation] called on <UIWindow: 0x3c04dd0; frame = (0 0; 320 480); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x3c05b90>> without matching -beginDisablingInterfaceAutorotation. Ignoring.
Terminating in response to SpringBoard's termination.**

I don't know why this is happen.

I create the project as a Navigation-Based application.In the mainWindow.xib it has the navigationController and as subview it has the navigationbar and the rootviewcontroller.

Then in the rootViewController I change to viewController instead of tableviewcontroller.
The second viewcontroller is also a viewcontroller.

Here is the code when i call the rootcontroller.

else if (emptyTasks == YES && returnAddTask == NO)
{
    [self.navigationController popToRootViewControllerAnimated:YES]; // "Pushing the controller on the screen" 

    returnAddTask = YES;
}

Thanks for your help!! :)

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

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

发布评论

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

评论(2

一个人的旅程 2024-08-26 12:13:00

这个答案来自对问题本身的评论。它只是被放入答案中,希望有人对其进行投票,因此可以将其从未答复列表中移出。

如果不使用动画,则不会出现错误消息。

[self.navigationController popToRootViewControllerAnimated:NO];

This answer comes from the comments to the question itself. It is just put in an answer with the hope of someone up voting it and as such it can be moved away from the unanswered list.

By not using animation the error message does not appear.

[self.navigationController popToRootViewControllerAnimated:NO];
§对你不离不弃 2024-08-26 12:13:00

我有同样的问题,但是当我在 UIScrollView 后面调用 popToRootViewController 时。 UIScrollView 碰巧从其父级窃取了自身。

解决方案是

[scrollview removeFromSuperview];

popToRootViewController 之前。

I have the same problem but when I call popToRootViewController behind UIScrollView. It happen that UIScrollView steal self from its parent.

The solution is

[scrollview removeFromSuperview];

before popToRootViewController.

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