[MacRuby-devel] My class's initialize not called

steve ross cwdinfo at gmail.com
Thu Jan 21 16:33:52 PST 2010


So that confirms my suspicion. It's not so much a MacRuby thing as a Cocoa thing. I just don't see how to set an initial state in a class that's instantiated when a nib is loaded. I don't do the alloc.initWithWhatever. On the previous subject though, adding super/self does not cause the initialize method to be called. Hmmmmmm...

On Jan 21, 2010, at 4:20 PM, Matt Aimonetti wrote:
> Overwriting the init method of a Cocoa class subclass is not recommended. Here is an example of what I was suggesting:
> 
> http://github.com/mattetti/phileas_frog/blob/master/image_layer.rb#L44
> 
> Which then get called there: http://github.com/mattetti/phileas_frog/blob/master/game_controller.rb#L57
> 
> In any cases, you still need to call init (or super if you overwrite initialize) and you need to return self.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20100121/f1df4f5f/attachment-0001.html>


More information about the MacRuby-devel mailing list