Swift 2 doesn't have a back button

I just migrated my project to Swift 2, and everything works fine - except that even the simplest segments do not have a return button. Here is the preparation for the segue function that I am using:

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

Before automatically filling in the button to return to the parent segment. Now all i get is the title in vc child navigation

+6
source share
1 answer

Are you displaying or displaying a detailed segment? It looks like you are using a modal session. The destination view controller for show or show segue is usually the second view controller and is not built into another UINavigationController .

If your destination view manager for show segue is really equal to the UINavigationController , the navigation bar settings of the new navigation controller may override the old one (source view controller navigation controller). Do not attempt to embed the destination controller in another UINavigationController .

+8
source

Source: https://habr.com/ru/post/989460/


All Articles