making things better, making better things

Tuesday, September 6, 2011

awake! from nib!

Tonight’s MacRuby/Xcode lesson: An object (say, an instance of a subclass of NSArrayController) created in Interface Builder won’t necessarily have its initialize method called when the program runs. This, I guess, is because the object was instantiated when you created it in Interface Builder, and cryogenically frozen, and when your program runs, it doesn’t instantiate the object, it merely wakes it up. So you should put the initialization code in awakeFromNib. I think.

(The init method on an instance of a subclass of NSObject was called. I don’t know why init and not initialize. I’ve got a lot to learn.)

posted by erik at 7:32 pm  

Powered by WordPress