Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 导航后导航栏损坏_Ios_Swift_Uinavigationcontroller_Uipageviewcontroller - Fatal编程技术网

Ios 导航后导航栏损坏

Ios 导航后导航栏损坏,ios,swift,uinavigationcontroller,uipageviewcontroller,Ios,Swift,Uinavigationcontroller,Uipageviewcontroller,这就是目前的情况: UITabBarController UINavigationController UIPageViewController Some UIViewControllers (the actual content) 因此UIPageViewController包含一些UIViewController,它们都包含一个UITableView 当我单击UITableView中的一行时,UIViewController调用didSel

这就是目前的情况:

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)
}
func dayTableViewSelectedActivity(activity: Activity, sender: DayTableViewController) {
    self.performSegueWithIdentifier("openDetails", sender: activity)
}
然后UIPageViewController已经实现了协议,因此正在调用委托方法。方法如下所示:

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)
}
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.

这个错误让我沮丧了好几个小时,我不知道我做错了什么。没有双段。我检查了好几次。我希望你们能帮助我。

你们需要确保当你们导航回PageViewController时,你们使用的是Unwind Segue。这将从堆栈顶部弹出TableViewController,并将您返回到PageViewController。下面是一篇关于如何在Swift中使用它的文章”


在挣扎了几个小时后,我在这里找到了答案:


我确实为我的UITableBarController创建了一个子类,它覆盖了
ViewDidAspect
方法。我添加了
super.ViewDidAspect
,现在一切都正常了。

谢谢!我回家后会试试。我会告诉你的。不幸的是,它不起作用。在教程中,它们以编程方式进行了一个展开阶段。但我我不想要默认的iOS行为(当你在UINavigationController中向右滑动时,你会转到上一个视图控制器)…所以当我在我的DetailViewController中向右滑动时,我想要回到UIPageViewController。