这是目前的情况:
UITabBarController
UINavigationController
UIPageViewController
Some UIViewControllers (the actual content)
所以UIPageViewController包含一些UIViewController,它们都包含一个UITableView。
当我单击 UITableView 中的某一行时,UIViewController 会调用 didSelect 方法。该方法如下所示:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
tableView.deselectRowAtIndexPath(indexPath, animated: true)
let activity = self.activities[indexPath.row - 1]
self.delegate?.dayTableViewSelectedActivity(activity, sender: self)
}
然后 UIPageViewController 已经实现了该协议(protocol),因此正在调用委托(delegate)方法。该方法如下所示:
func dayTableViewSelectedActivity(activity: Activity, sender: DayTableViewController) {
self.performSegueWithIdentifier("openDetails", sender: activity)
}
然后应用程序导航(推送)到 DetailViewController。当我向后滑动(默认 iOS 行为)时,DetailViewController 会立即弹出到 UIPageViewController,而不显示动画。然后我的导航栏坏了,并且包含一个不属于那里的后退按钮,因为我无法再返回。
当我再次单击某个单元格时,控制台会显示嵌套推送动画可能导致导航栏损坏
消息。我从那里采取的每一个操作都会给我带来更多控制台错误,例如:
nested pop animation can result in corrupted navigation bar
Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
这个错误让我沮丧了几个小时,我不知道我做错了什么。没有双重转场。我检查了多次。希望大家能帮帮我。
最佳答案
再苦苦挣扎几个小时后,我在这里找到了答案:Pop animation is not working in first UINavigationController of UITabbarController
我确实有一个 UITTabBarController 的子类,它重写了 viewDidAppear 方法。我添加了 super.viewDidAppear
现在一切正常。
关于ios - 导航后导航栏损坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37688748/