sprite kit - SKSpriteNode removeFromParent in touchesEnded -


i have issue removing skspritenode it's parent when touch detected on skspritenode. here code:

-(void)touchesended:(nsset *)touches withevent:(uievent *)event {     (uitouch *touch in touches) {          cgpoint scenelocation = [touch locationinnode:self];         if ([_tabledonebutton containspoint:scenelocation]) {             nslog(@"here");             [self removeitemsfromview];             _headernode.portlabel.text = [ipgamemanager sharedgamedata].world.player.port.name;             [_portnode show];         }          sknode *nodeinport = [_portnode nodeatpoint:[touch locationinnode:_portnode]];         if ([nodeinport.name isequaltostring:@"marketbutton"]) {             [self showmarket];         }     } }  

in showmarket function, 'done' skspritenode added user can leave market when he/she wants to. can see above, if _tabledonebutton contains touch location, should call removeitemsfromview function contains [_tabledonebutton removefromparent];. have special when removing nodes way?

another issue: seems removed ~1 second later. happens when run [node removefromparent]? if set skspritenode nil after call [self removeitemsfromview] works fine. shouldn't have that?


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -