3

I have a push segue between one view controller and another. When the selects a certain option from an action sheet, the segue is performed and the view appears. I created the segue as per this answer.

On iOS 8, this works fine. The view is added to the navigation controller and a back button appears automatically. On iOS 7 however, I've just noticed that the view appears as a modal and doesn't show the Navigation Bar at all. I don't know when this started happening, but I can't seem to figure out why.

When the action sheet item is pressed, I use:

[self performSegueWithIdentifier:@"showRouteInformationFromMap" sender:nil];

to call the segue. I prepare the segue using:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([[segue identifier] isEqualToString:@"showRouteInformationFromMap"]) {
        [[segue destinationViewController] setRouteInfo:selectedRouteID];
    }
}

Which just assigns a value on the destination controller. I don't make any changes to the Navigation Bar on either view controller.

Community
  • 1
  • 1
ecnepsnai
  • 1,882
  • 4
  • 28
  • 56
  • A bit of a stab in the dark here, but there were segues added to iOS 8 that weren't available in iOS 7. What type of segue have you defined in the storyboard? Wondering if you've picked an iOS 8-only segue and it is falling back to a modal segue on iOS 7 since that segue type doesn't exist. – JiuJitsuCoder Aug 26 '15 at 17:25
  • The segue type is "Show (e.g. Push)" according to the interface builder. I have another segue that is shown using the exact same method, but works. – ecnepsnai Aug 26 '15 at 17:27
  • Yeah that shouldn't be an issue then. Just noticed that your prepareForSegue: method call has a different segue identifier in the if clause than the one defined in the action sheet call. Not sure if that is affecting you. – JiuJitsuCoder Aug 26 '15 at 17:30
  • Sorry, that was a copypasta mistake. – ecnepsnai Aug 26 '15 at 17:32
  • k, someone else might be able to help more than me. I'd need to see how the storyboard is wired up and the different properties in the view controller to verify that everything is as it should be. – JiuJitsuCoder Aug 26 '15 at 17:41

2 Answers2

3

Try to remove your segue in storyboard and create a segue again. This approach worked for me in iOS 10.

Iman
  • 339
  • 3
  • 5
  • Haha what a crazy bug. Seems that if you create a Show detail segue, then change its type to Show (Push), it won't show the Nav Bar. That's why you need to recreate it. And then it works! – Matei Suica Mar 10 '18 at 11:51
2

2 workarounds are there.

the show segue is introduced in iOS 8 and hence the unexpected behavior in 7 is very much expected.

1st workaround: push your controller manually

UIViewController *myController = [self.storyBoard.instantiateViewControllerWithIdentifier:@"storyboardIdentifier"];
self.navigationController pushViewController:myController animated:YES];

2nd workaround: Using storyboard

disconnect the show segue and connect the push segue (displayed as deprecated).

Rohit Kumar
  • 877
  • 6
  • 20