我刚刚将我的项目移植到 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 中的标题