Hi,
I'm an experienced developer but very new to the Mac and Objective C
I'm teaching myself by developing a game. One thing has be confused. (To be honest, about a thousand things have me confused, but this one is just puzzling the poop out of me!)
I have a class with a property defined as
and in the class I have
Then, in a method I have
All good, works fine.
Originally, I had the following code:
which built fine, and ran but crashed on that line.
I guess that if you have to specify self. then that's just the way things are (I come from a C# background mainly, where the equivalent is to use this.terrain or just terrain pretty much interchangeably) but I don't understand why it would compile?
What does 'terrain = foo;' mean, if not self.terrain = foo;?
I'm an experienced developer but very new to the Mac and Objective C
I'm teaching myself by developing a game. One thing has be confused. (To be honest, about a thousand things have me confused, but this one is just puzzling the poop out of me!)
I have a class with a property defined as
Code:
@property (nonatomic, retain) NSMutableArray* terrain;
and in the class I have
Code:
@synthesize terrain;
Then, in a method I have
Code:
-(void)setUpLayer
{
self.terrain = foo;
}
All good, works fine.
Originally, I had the following code:
Code:
-(void)setUpLayer
{
terrain = foo;
}
which built fine, and ran but crashed on that line.
I guess that if you have to specify self. then that's just the way things are (I come from a C# background mainly, where the equivalent is to use this.terrain or just terrain pretty much interchangeably) but I don't understand why it would compile?
What does 'terrain = foo;' mean, if not self.terrain = foo;?