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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8224366/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 15:31:20  来源:igfitidea点击:

"Unbalanced calls to begin/end appearance transitions" warning when push a view in a modal way in XCode 4 with Storyboard

iphoneiosxcode4uinavigationcontrollerstoryboard

提问by Vinestro

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 performSegueWithIdentifiermethod (I'm using storyboard). Here is my code:

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

[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?

谁能帮我?

回答by Mark Adams

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

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

Try performing the segue in -viewDidAppear.

尝试在-viewDidAppear.

回答by infiniteLoop

'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];

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

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

看看这是否解决了问题,在我的情况下,这解决了问题。

回答by DonnaLea

I had this problem, but what I had done is on a UIViewControllerI had linked a Segue from a UIButtonand also coded it into a nextBtnPressed:function, so I was actually pushing two new UIViewControllerson 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.

我遇到了这个问题,但我所做的是在 aUIViewController上链接了一个 SegueUIButton并将其编码为一个nextBtnPressed:函数,所以我实际上是UIViewControllers在按下一个按钮时推了两个新的。将其限制为一个 segue 修复了它。但是经过一番调查才发现我已经完成了这个加倍。

回答by Anjaan

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.
  1. 初始化声音文件,(异步)播放 1.4 秒,
  2. 使用定时为持续 1.4 秒的动画使图像在屏幕上移动,并且,
  3. 在第 2 步之后将计时器设置为 1.4 秒,推动视图控制器。

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.

我发现的是,如果我没有一个接一个地获得这 3 个步骤的说明(如果我将它们混在一起),那么我会收到错误“呼叫不平衡...”。此外,如果我将视图控制器的推送时间设置为小于 1.4 秒,我也会收到消息。

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

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