On 09/09/2010, at 4:22 AM, macruby-devel-requ...@lists.macosforge.org wrote:

> Date: Wed, 8 Sep 2010 11:22:37 -0700
> From: Thibault Martin-Lagardette <thibault...@gmail.com>
> 
>> I don't think I've seen any examples using the initWith method. Is that 
>> method called after init?
> 
> Simply something of the like:
> 
> - (id)initWithDelegate:(id)someDelegate
> {
>    [self setDelegate:someDelegate];
> }
> 
> or
> 
> - (id)initWithColor:(MRColor)color andBorderSize:(int)borderSize
> {
>    [self setCubeColor:color];
>    [self setBorderSize:borderSize];
> }

Those are never actually initialising the object - do you mean something like 
this? (assuming the class in question doesn't inherit from something with a 
different designated initialiser)


- (id)initWithDelegate:(id)someDelegate
{
  if (self = [super init])
  {
    [self setDelegate:someDelegate];
  }
  return self
}

or

- (id)initWithColor:(MRColor)color andBorderSize:(int)borderSize
{
  if (self = [super init])
  {
    [self setCubeColor:color];
    [self setBorderSize:borderSize];
  }
  return self;
}


cheers

Russell

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to