在 tableView 中选择单元格时,对 UIViewController 的 begin/end 外观转换的调用不平衡

Unbalanced calls to begin/end appearance transitions for UIViewController when selecting cells in tableView

我知道这个问题已经被问过很多次了,但我已经尝试了其他问题中的一些解决方案,但没有成功。

在我的应用程序中,我有四个选项卡,每个选项卡都有自己的 UINavigationController。第一个 - UserIndexController 是一个包含 table 的 UIViewController。当一个单元格被 selected 时,我初始化一个新的 UIViewController 并将其推送到它的 UINavigationController 上。这是代码:

tableView.deselectRowAtIndexPath(indexPath, animated: true)
user = data[indexPath.row]
controller = UserViewController.alloc.initWithNibName(nil, bundle: nil)
controller.user = user
self.navigationController.pushViewController(controller, animated:true)

一旦单元格被 selected,几乎在 UserViewController 加载后我得到:

Unbalanced calls to begin/end appearance transitions for UserIndexController.

当我在 NavigationController 中从 UserViewController 返回到 UserIndexController 时,我得到:

Unbalanced calls to begin/end appearance transitions for UserViewController.

输入疯狂(至少对我来说):当我的应用程序加载时,如果我 select 在 select 在我的 UserIndexController 中输入单元格之前的任何其他选项卡,然后返回对于我的 UserIndexController 和 select 一个单元格,不平衡呼叫警告消失了。

这就是我所在的位置。如果有人有任何想法或建议,我很乐意听取他们的意见。如果有帮助,我也很乐意提供更多代码。

看来我的搜索不够好。我在 this 问题中找到了答案。本质上,在我的 UITabController 中我调用了 viewWillAppear 但没有调用 super。这样做修复了它。

在您的 'animated:' 之一中输入 NO 即可解决您的问题。