ios - Adding a node inside didMoveToView does not appear, however having same code for multiple elements works as expected -


i confused why adding shape node inside of didmovetoview give me no results, when call function , perform drawing there renders fine.

here code -this example not work

-(void)didmovetoview:(skview *)view {     skshapenode *shape = [[skshapenode alloc] init];      cgmutablepathref mypath = cgpathcreatemutable();      cgpathmovetopoint(mypath, null, self.sizeofhorizontalsquares, self.sizeofverticalsquares);      cgrect bound = cgrectmake(50, 50, self.sizeofhorizontalsquares,self.sizeofverticalsquares);      cgpathaddrect(mypath, null, bound);      shape.path = mypath;       [shape setfillcolor:[uicolor colorwithred:1 green:.6 blue:.3 alpha:1.0]];      [shape setstrokecolor:[uicolor colorwithred:.1 green:.3 blue:.8 alpha:0.2]];      [shape setglowwidth:1.0];      [self addchild:shape];   } 

-here code works array

-(void)didmovetoview:(uiview *)view {  self.sizeofverticalsquares = 20; self.sizeofhorizontalsquares = 20; [self configuresquire]; [self rendersquiares];  }  -(void)configuresquiare {     for(int = 0; < 6; i++)     {         for(int j = 0; j < 5; j++)         {               skshapenode *shape = [[skshapenode alloc] init];              cgmutablepathref mypath = cgpathcreatemutable();              //cgpathmovetopoint(mypath, null, i*self.sizeofhorizontalsquares, j*self.sizeofverticalsquares);              cgrect bound = cgrectmake(self.sizeofhorizontalsquares, self.sizeofverticalsquares, self.sizeofhorizontalsquares,self.sizeofverticalsquares);              cgpathaddrect(mypath, null, bound);              shape.path = mypath;              [self.squares addobject:shape];          }     }     }  -(void)rendersquiares {     for(int = 0; < self.squares.count; i++)     {         [[self.squares objectatindex:i] setfillcolor:(__bridge cgcolorref)[uicolor colorwithred:1 green:.6 blue:.3 alpha:1.0]];          [[self.squares objectatindex:i] setstrokecolor:(__bridge cgcolorref)[uicolor colorwithred:.1 green:.3 blue:.8 alpha:0.2]];          [[self.squares objectatindex:i] setglowwidth:1];          [self addchild:[self.squares objectatindex:i]];      }  } 


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -