4
votes

I have a little problem with segues in my app. I am trying to manual PUSH segue. But navigation item/controller/bar is not visible on target controller. When i use button and segue with that button to target view controller, navigation bar IS visible :/

My code is simple:

[self performSegueWithIdentifier:@"MySegue" sender:self];  

MySegue is push segue from root view controller of UINavigationController to target controller.

It even did not work with this one

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:[NSBundle mainBundle]];
    UIViewController *controller = [storyboard instantiateViewControllerWithIdentifier:@"TargetViewController"];
    [self.navigationController pushViewController:controller animated:YES];

and even if i set top bar (navigation item) in story board manualy

thanks for any help:)

3
The NavigationBar (top bar) is 'inferred' at the target segue? can u add storyboard screenshots for the source and the target of the segue?gran33
Did you embed in navigation controller? The arrow that is on left side of initial view controller, should point to first controller in storyboard.! I suppose you are doing that!Vish

3 Answers

3
votes

Delete the segue that goes from StaznostiViewController to StaznostViewController. Control-drag from the StaznostiViewController object (in the bar below the view) to the StaznostViewController, NOT from the StaznostiViewController view or from the StaznostiViewController tableview prototype cell. Select Push style. Name your segue whatever you wish.

In your code, in the target-action method that you have defined for your dynamic button(s), this is where you call the method performSegueWithIdentifier.

Also, make sure that in the properties for StaznostViewController, you have the property for Top Bar set to Inferred.

0
votes

Same thing happened to me. I created a "Push" segue from storyboard, and was calling it from code. Then it lost navigation items on the navigation bar. When I changed the segue to "Modal", then navigation items of the destination view appeared properly. .

-1
votes

try nil sender instead of self:

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

hope it works