对 <UITabBarController: 0x197870> 的开始/结束外观转换的不平衡调用

人气:269 发布:2022-10-16 标签: ios ios4 uitabbarcontroller

问题描述

我读到另一位用户遇到类似 错误,但是这个错误是不同的情况.

I read SO about another user encountering similar error, but this error is in different case.

我最初添加视图控制器时收到此消息:

I received this message when I added a View Controller initially:

Unbalanced calls to begin/end appearance transitions for 
<UITabBarController: 0x197870>

应用的结构如下:

我有一个 5 选项卡 TabBarController 链接到 5 个视图控制器.在初始显示选项卡中,我调用了一个新的 View Controller 来覆盖作为应用程序的介绍.

I got a 5-tab TabBarController linked to 5 View Controllers. In the initial showing tab, I call out a new View Controller to overlay as an introduction of the app.

我用这段代码来调用介绍视图控制器:

I use this code to call the introduction view controller:

IntroVC *vc = [[IntroVC alloc] init];
[self presentModalViewController:vc animated:YES];
[vc release]; 

在这个 IntroVC 视图控制器出现后,上面的错误就会出现.

After this IntroVC view controller shows up, the above error shows.

附言我正在使用 xCode 4.2 &iOS 5.0 SDK,开发 iOS 4.3 应用.

p.s. I am using xCode 4.2 & iOS 5.0 SDK, developing iOS 4.3 app.

推荐答案

没有看到更多的周边代码我无法给出明确的答案,但我有两个理论.

Without seeing more of the surrounding code I can't give a definite answer, but I have two theories.

您没有使用 UIViewController 的 指定初始化器initWithNibName:bundle:.尝试使用它,而不仅仅是 init.

另外,self 可能是标签栏控制器的视图控制器之一.始终从最顶层的视图控制器呈现视图控制器,这意味着在这种情况下要求标签栏控制器代表视图控制器呈现覆盖视图控制器.您仍然可以将任何回调委托保留给真正的视图控制器,但您必须让标签栏控制器存在并关闭.

Also, self may be one of the tab bar controller's view controllers. Always present view controllers from the topmost view controller, which means in this case ask the tab bar controller to present the overlay view controller on behalf of the view controller. You can still keep any callback delegates to the real view controller, but you must have the tab bar controller present and dismiss.

528