objective c - SKLabelNode subclass has zero frame -


here have straightforward implementation of sklabelnode subclass.

the interface:

#import <spritekit/spritekit.h>  @interface cslabelnode : sklabelnode  - (instancetype)initwithfontnamed:(nsstring *)fontname fontsize:(cgfloat)fontsize fontcolor:(skcolor *)fontcolor;  @end 

the implementation:

#import "cslabelnode.h"  @implementation cslabelnode  - (instancetype)initwithfontnamed:(nsstring *)fontname fontsize:(cgfloat)fontsize fontcolor:(skcolor *)fontcolor {     self = [super initwithfontnamed:fontname];     if (self) {         self.fontsize = fontsize;         self.fontcolor = fontcolor;     }     return self; }  @end 

i calling regular sklabelnode , custom cslabelnode this:

cslabelnode *custom = [[cslabelnode alloc] initwithfontnamed:@"crimsontext-bold" fontsize:30.0f fontcolor:[skcolor redcolor]; sklabelnode *regular = [[sklabelnode alloc] initwithfontnamed:@"crimsontext-bold"];  custom.text = @"some text"; regular.text = @"some text"; 

the problem frame custom node origin=(x=0, y=0) size=(width=0, height=0), while regular node's frame is, expected: origin=(x=-43, y=-1) size=(width=86, height=25)

what have custom object have non-zero frame property?


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -