ios - 导航后导航栏损坏

标签 ios swift uinavigationcontroller uipageviewcontroller

这是目前的情况:

UITabBarController
    UINavigationController
        UIPageViewController
            Some UIViewControllers (the actual content)

所以UIPageViewController包含一些UIViewController,它们都包含一个UITableView。

This is what the Apps looks like

当我单击 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,而不显示动画。然后我的导航栏坏了,并且包含一个不属于那里的后退按钮,因为我无法再返回。

Broken navigation bar

当我再次单击某个单元格时,控制台会显示嵌套推送动画可能导致导航栏损坏消息。我从那里采取的每一个操作都会给我带来更多控制台错误,例如:

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/

相关文章:

ios - 如何让导航按钮位于导航栏的左上角

ios - TabBarController 不会更改选定的索引

ios - 在 Objective-C 中使用 Swift 代码时出现的问题

ios - 如何将数字传递给手势识别器操作?

unit-testing - 单元测试用例 View Controller 崩溃 swift

ios - 以编程方式导航到另一个 View Controller /场景

ios - 推送通知无法通过 TestFlight 在 iOS 10 上运行

ios - UITextView 不播放点击声音

php - 在移动 Safari 上使用 Zend_Form_Element_File 验证 Zend Forms

iOS 应用程序试图以模态方式呈现一个事件 Controller