Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Danneman101

macrumors 6502
Original poster
Aug 14, 2008
361
1
Is it possible to combine Storyboards with traditional nib-files?

The reason I'm asking is that storyboards do not expose the AppDelegate, and if you wish to call a method in another class from the AppDelegate it's excruciatingly painful (exampel: http://www.raywenderlich.com/5138/beginning-storyboards-in-ios-5-part-1).

I know it's possible to use them both separately in a single project, but how can I make them interact?

I was thinking the nib-file, exposing the AppDelegate, could connect to the relevant views in the storyboard that it wants to call methods from.

Am I just dreaming?
 
Is it possible to combine Storyboards with traditional nib-files?
It is, similar to how it's possible to combine nib-files with programmatically defined user-interface.

This is how you can do it programmatically, however (look at the bottom as to skip my frustrated flailing ;) ):

https://forums.macrumors.com/threads/1289152/

To be clear, that issue you had in your other thread was more about getting access to a viewController from within a storyboarded app than it was about combining storyboards and NIBs.
 
What I really meant was if it's possible to link, for instance, an outlet in the nib-file exposing AppDelegate, to an object in another view that is exposed in the storyboard. Is that really possible without doing it programmatically similarly to the link I've attached?
 
Well, for instance, even if you have both a nib-file that exposes the app-delegate (and in the AppDel.h you have an iboutlet for a view called, say, firstViewController), and you also have a storyboard (that by default excludes the app-delegate object), you can't connect the outlet firstViewController from the nib-file to the firstViewController-object in the storyboard using the connection inspector.

But I think I missed an obvious solution: what if you created a new ViewController-object in the nib-file and linked it to the FirstViewController-class, and did the connection to the firstViewController here in the nib-file's connection inspector. That way you'd have two representations of the firstViewController-object, one inside the nib-file and one inside the storyboard, but the connections would still be made. I'll try it out when I get home, but would it work or will the xcode debugger complain about a duplicated object or something?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.