I am working on a subclass of SKNode
called UtilityNode
@implementation UtilityNode
- (id)initWithName:(NSString *)rootName {
self = [super init];
if(self) {
[self setName:rootName]; // ?
}
return self;
}
@end
I am setting up a designated initialiser for the new node initWithName:
where I am trying to initialise the name of the superclass SKNode
when creating the new subclass. I was under the impression that I could just write _name = rootName;
but _name was flagged as undeclared. I have got it working (as you can see above) by using [self setName:rootName];
Can anyone shine some light on this, am I doing this correctly?