0

I am trying to convert my App to a Storyboard, but am having some problems. In de previous model I could have an 'actionClass' in my AppDelegate which I called when I needed to pop-up a view.

E.g.

DOArticleViewController *articleView = [[DOArticleViewController alloc] initWithArticle:article notification: notification nibName:@"DOArticleViewController" bundle:nil];
[[self navigationController] pushViewController:articleView animated:YES];  

But now with the storyboard it does not work anymore. Then I tried the following code in the AppDelegate:

id currentController = [[[[self window] rootViewController] navigationController] visibleViewController];
[currentController performSegueWithIdentifier:@"settingsSeque" sender:nil];

Don;t think this is the best anyway, as only the rootViewController has all the seques needed, and might not be the visibleViewController, but one step at a time.

With this the only thing I see happening is the message and no action:

Unbalanced calls to begin/end appearance transitions for UINavigationController: 0xb428e00.

I spend a view hours now on trying to figure out to get this to work, but am realising that it might be better to go back to the traditional independent XIB files....

Luuk D. Jansen
  • 4,402
  • 8
  • 47
  • 90
  • I personally find storyboards to be a huge pain and not usable in apps that have complicated navigation flows. I would look at these pros and cons analyses: http://stackoverflow.com/questions/10872090/pros-and-cons-of-using-storyboards http://blog.waynehartman.com/archive/2012/01/07/uistoryboard-on-ios-5-the-good-the-bad-and-the.aspx Sounds like you are trying to perform a segue from anywhere in your app by calling back to the App Delegate? Does the segue belong to the nav controller or the article controller? – Chris Truman Jul 16 '13 at 22:02
  • The seque currently resides with the rootviewcontroller, which is also the visible view at the point if calling. But it does not seem to work. I like storyboards because if the clear overview and the proto table cells. But maybe I should just decide to call it a loss and revert my changes. A pitty through. An you call on the navigation controller directly icm a storyboard? – Luuk D. Jansen Jul 16 '13 at 22:19
  • Storyboards are nice in that they give you a great app overview and some other nice features, but quickly become a pain when trying to do custom things. From the error, it sounds like your segue gets activated, but then the navigationController is told to do another transition before it finishes. Maybe place some breakpoints in the settingsSegue controller and see if its being segue'd to properly. prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender – Chris Truman Jul 16 '13 at 23:22

1 Answers1

0

I solved with the answer given in this question: ios: Accessing a navigation controller from app delegate

I tried to get the Navigation Controller, but this was nil and I didn't realise it. My navigation controller was the rootViewController, so that is also the NavigationController.

Casting the rootViewController to NavigationController and invoking 'visibleViewController' worked fine after that!

Community
  • 1
  • 1
Luuk D. Jansen
  • 4,402
  • 8
  • 47
  • 90