Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 239
Adam Eisfeld Avatar asked Dec 26 '11 14:12

Adam Eisfeld


1 Answers

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

like image 116
Firoze Lafeer Avatar answered Nov 10 '22 02:11

Firoze Lafeer