“对开始/结束外观转换的不平衡调用”在 XCode 4 中使用 Storyboard 以模态方式推送视图时发出警告
在网上进行了一些研究但没有成功后,我来这里向您询问有关我的警告的问题。
实际上,我有一个带有导航控制器的视图 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
听起来您可能在
-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
.我遇到了这个问题,但我所做的是在
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 aUIButton
and also coded it into anextBtnPressed:
function, so I was actually pushing two newUIViewControllers
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.“对开始/结束外观转换的不平衡调用”
表示动画在最后一个相关动画未完成之前启动。
那么,在推送新视图控制器之前,您是否会弹出任何视图控制器?
或者可能会弹出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.
造成这种情况的原因是多方面的,并且与上下文和编程有关。例如,我正在做的是
我发现,如果我没有一个接一个地执行这 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
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.