ios - Moving object after creation -
i trying move uiimageview object after created, seem having problems accomplishing this. actual creation of image working fine. code have far:
//spawning random objects -(ibaction)spawn{ spawn = [nstimer scheduledtimerwithtimeinterval:1.0f target:self selector:@selector(spawnmechanism) userinfo:nil repeats:yes]; } -(ibaction)spawnmove{ spawnmove = [nstimer scheduledtimerwithtimeinterval:1.0f target:self selector:@selector(spawnmovemechanism) userinfo:nil repeats:yes]; } -(uiimageview *)spawnmovemechanism:(uiimageview *)spawngood{ spawngood.center =cgpointmake(spawngood.center.x, spawngood.center.y+100); nslog(@"spawnmovemechanism accomplished"); homecoming spawngood; } -(void)spawnmechanism{ timesincelastspawn++; if(timesincelastspawn >= 3) { if( arc4random() % 10 < 7 ){ uiimageview *spawngood; spawngood=[[uiimageview alloc]initwithframe:cgrectmake(arc4random() % 700, 50, 70,70)]; uiimage *image; image=[uiimage imagenamed:@"friendly-01"]; [spawngood setimage:image]; [self.view addsubview:spawngood]; nslog(@"spawngood spawned"); [self spawnmovemechanism]; } } }
is able suggest solution this? in advance
ios objective-c
No comments:
Post a Comment