objective c - Interface Builder and Cocoa: wiring up behind an App Controller class -


i have been following this tutorial. i'm having conceptual trouble @ point app controller class written, , added , hooked within interface builder.

adding appcontroller class next task add instance of new class interface builder document , connect class outlets.

create instance of appcontroller class. in interface builder library window, click classes. locate appcontroller class. drag class document window create instance named app controller. connect app controller’s qcwindow outlet design window. hold down control key. in document window, drag app controller window object. select qcwindow outlet list appears. connect app controller’s qcview outlet qc view in design window. hold down control key. drag app controller qc view in design window. select qcview outlet list appears.

specifically, don't understand how app controller being used @ run-time. did hook window , view outlets within ib, , magically works if being initialized within applicationdidfinishlaunching:anotification method of app delegate. point is, i'm not using app controller class anywhere in code, , i've done in ib hook outlets, how work?

when application launched, shared instance of nsapplication created , mainmenu.xib/nib loaded , contents (including main menu itself) hooked up. during loading processs, nsapp instance's delegate pointed @ "un-freeze-dried" (unarchived) class, (among other possible things) can answer nsapp delegate questions , can begin messaging (and relying on app-wide behavioral customizations).

one useful aspect of can access delegate anywhere in app via [nsapp delegate], short [[nsapplication sharedapplication] delegate]. extremely handy navigating parts of architecture if hang them off app delegate , provide accessors them (like [[nsapp delegate] foocontroller]).


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -