“对开始/结束外观转换的不平衡调用”在 XCode 4 中使用 Storyboard 以模态方式推送视图时发出警告

发布于 2024-12-17 07:16:30 字数 437 浏览 0 评论 0原文

在网上进行了一些研究但没有成功后,我来这里向您询问有关我的警告的问题。

实际上,我有一个带有导航控制器的视图 V1,我想在 V1 完成加载时推送模态视图 V2。 所以我使用 performSegueWithIdentifier 方法(我使用的是 Storyboard)。 这是我的代码:

[self performSegueWithIdentifier:@"showConnexionViewSegue" sender:self];

当我编译时,我收到此警告:

Unbalanced calls to begin/end appearance transitions for <UINavigationController: 0x6849b30>

任何人都可以帮助我吗?

After some research on the web without success, I come here to ask you the question about my warning.

Actually, I have a view V1 with a navigation controller and I want to push a modal view V2 when V1 has finished loading.
So I use the performSegueWithIdentifier method (I'm using storyboard).
Here is my code:

[self performSegueWithIdentifier:@"showConnexionViewSegue" sender:self];

And when I compile, I got this warning:

Unbalanced calls to begin/end appearance transitions for <UINavigationController: 0x6849b30>

Can anyone help me?

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

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

发布评论

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

评论(4

み格子的夏天 2024-12-24 07:16:30

听起来您可能在 -viewWillAppear: 中执行 segue,从而生成两个 -viewWillAppear: 消息,而没有 2 个相应的 -viewDidAppear 消息。

尝试在 -viewDidAppear 中执行 segue。

It sounds like you may be performing the segue in -viewWillAppear: thus generating two -viewWillAppear: messages without 2 corresponding -viewDidAppear messages.

Try performing the segue in -viewDidAppear.

猫性小仙女 2024-12-24 07:16:30

我遇到了这个问题,但我所做的是在 UIViewController 上,我从 UIButton 链接了 Segue,并将其编码到 nextBtnPressed: > 函数,所以我实际上是通过一键按下来推动两个新的 UIViewControllers 。将其限制为仅一个 segue 即可解决此问题。但经过一些调查才发现我已经完成了这个双倍的工作。

I had this problem, but what I had done is on a UIViewController I had linked a Segue from a UIButton and also coded it into a nextBtnPressed: function, so I was actually pushing two new UIViewControllers on the one button press. Limiting it to just the one segue fixed it. But it took some investigating to see that I had done this double up.

小苏打饼 2024-12-24 07:16:30

“对开始/结束外观转换的不平衡调用”

表示动画在最后一个相关动画未完成之前启动。
那么,在推送新视图控制器之前,您是否会弹出任何视图控制器?
或者可能会弹出root?如果是,请尝试在没有动画的情况下这样做
即 [self.navigationController popToRootViewControllerAnimated:NO];

看看这是否能解决问题,就我而言,这成功了。

'Unbalanced calls to begin/end appearance transitions for '

Says an animation is started before the last related animation isnt done.
So, are you popping any view controller before pushing the new one ?
Or may be popping to root ? if yes try doing so without animation
i.e. [self.navigationController popToRootViewControllerAnimated:NO];

And see if this resolves the issue, In my case this did the trick.

魔法少女 2024-12-24 07:16:30

造成这种情况的原因是多方面的,并且与上下文和编程有关。例如,我正在做的是

  1. 初始化一个声音文件,(异步)播放它 1.4 秒,
  2. 使用定时为持续 1.4 秒的动画使图像在屏幕上移动,并且
  3. 在步骤 2 之后将计时器设置为 1.4 秒,按下一个视图控制器。

我发现,如果我没有一个接一个地执行这 3 个步骤的说明(如果我将它们混淆),那么我会收到错误“不平衡调用...”。另外,如果我将视图控制器的推送时间控制在 1.4 秒以内,我也会收到该消息。

因此,请检查程序指令的顺序和时间是否正确。

The reasons for this are manifold and are very specific to the context and the programming. For example, what I was doing was

  1. initialising a sound file, playing it (asynchronously) for 1.4 seconds,
  2. making an image move across the screen using animation timed to last 1.4 seconds and,
  3. with a timer set to 1.4 seconds after step 2, pushing a viewcontroller.

What i discovered is that if I DO NOT have the instructions for these 3 steps one after the other (if I mix them up), then I get the error "Unbalanced calls...". Also, if I time the push of the viewcontroller to less than 1.4 seconds, I get the message as well.

So, check that the sequence and timing of your program instructions are correct.

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