xcode - When to use awakeFromNib , initWithWindow , windowDidLoad methods? -


can please explain me when have use methods ? , in sort of situation should use method ? right test works , use (yea beginner).. thanks. developing mac.

first, should never call awakefromnib , windowdidload yourself. can implement them in custom classes, , cocoa call them @ appropriate time.

awakefromnib works objects loaded nib archive, not windows , window controllers. it's general place setup—it's safe (you're guaranteed object loaded, has returned init call, , has of outlets set), still pretty early.

windowdidload (and windowwillload) works windows, whether loaded nib archive or created on fly. it's not called on window, it's called on window's controller. (usually you're not creating own nswindow subclass, creating own nswindowcontroller subclass.) if have setup code depends on window being loaded, should put here (but it's not critical in simple cases, because try access window property, created).

initwithwindow: call yourself, beginning cocoa programmer doesn't ever want so.

you should read of guides come xcode. if want document-based app, start "document-based app programming guide mac". if want single-window utility app, you'll still need learn mvc , on, might want build document-based app first learn way around.

also, if want understand sequence of events, override every message can, , add nslog(@"%s", __function__); , syslogs reveal everything.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -