我刚刚将我的项目移植到 Swift 2,一切都运行良好 - 除了即使是最简单的 segues 也没有后退按钮。这是我正在使用的 segue 函数的准备:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
if segue.identifier == "showExercise" {
if let nav = segue.destinationViewController as? UINavigationController {
if let exercisesController = nav.topViewController as? ExercisesController {
let cell = sender as! WorkoutCell
if let workout = cell.name!.text {
exercisesController.exercises = Workouts[workout]!
exercisesController.navigationItem.title = workout
}
}
}
}
}
之前,父级 Segue 的后退按钮用于自动填充。现在,我得到的只是子导航 vc 中的标题
您使用的是显示还是显示详细信息?看起来您正在使用模态转场。 show 或 show segue 的目标视图控制器通常是第二个视图控制器本身,而不是嵌入到另一个视图控制器中UINavigationController
.
如果你的显示序列的目标视图控制器确实是一个UINavigationController
,新的导航控制器的导航栏设置可能会覆盖旧的(源视图控制器的导航控制器)。尝试不要将目标视图控制器嵌入到另一个视图控制器中UINavigationController
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)