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

Edward Moy emoy at apple.com
Thu Jan 21 16:53:58 PST 2010


This sounds like:

https://www.macruby.org/trac/ticket/250

Any subclass of a native Objective C class will fail to call initialize.  I do have a fix, but I've been working on other things at the moment.  I'll try to finish up and get back to 250 as soon as I can.

Ed

On Jan 21, 2010, at 4:33 PM, steve ross wrote:

> 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.
> 
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

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


More information about the MacRuby-devel mailing list