Cocoa - How to connect view's delegate to file's owner in storyboard mode?

Adam Eisfeld picture Adam Eisfeld · Dec 26, 2011 · Viewed 15k times · Source

When I use an .xib, I connect a view's delegate to the File's Owner via interface builder, then go into the view controller's .h file and set it as the delegate to complete the connection via .

However in storyboard mode, there is no file's owner object. I am using an engine called NinevehGL, which simplifies the process of rendering models with openGL. This engine requires that I create a view, set it's class to NGLView, connect it's delegate to the file's owner object, and add to the header file of the view controller .h file to complete the connection (and then implement the appropriate methods such as drawView in the view controller). This all work's great via .xib files, but how do I accomplish this via a storyboard?

I would obviously prefer to adopt the new storyboarding technique in xcode, but I cant seem to figure out how to mimic the process I normally do in an .xib with a storyboard. The apple docs mention the using the rootViewController, but the explanation is a little fuzzy.

Can anyone explain the process to me?

Answer

Firoze Lafeer picture Firoze Lafeer · Dec 26, 2011

In nibs earlier, typically the file's owner was just the view controller that loaded its view from that nib.

Now with storyboards, the view controller that implements a particular scene is included with the scene itself. You can see it in the bar below the scene (see pic)

So where you made connections to the file's owner before, now you make them directly to the view controller. Don't forget to set the class of that view controller object to the correct class.

enter image description here