objective c - iphone - moving a UIImageView -
i'm having difficulty moving image location after first animation finished.
the image animates @ point i've specified, stops (that works fine). move image location , repeat.
here's code:
-(void) loadtap { nsarray *imagearray = [[nsarray alloc] initwithobjects: [uiimage imagenamed:@"tap1.png"], [uiimage imagenamed:@"tap2.png"], [uiimage imagenamed:@"tap3.png"], [uiimage imagenamed:@"tap4.png"], nil]; tapimage.animationimages = imagearray; tapimage.animationrepeatcount = 1; [imagearray release]; tapimage.animationduration = 1; tapimage.animationrepeatcount = 20; [tapimage startanimating]; tapimage.center = cgpointmake(156, 110); }
thanks help.
in order move image, should enclose code move in animation block:
[uiview beginanimations:nil context:nil]; [uiview setanimationduration:0.5]; tapimage.center = cgpointmake(156, 110); [uiview commitanimations];
you can give method execute upon completion of animation uiview setanimationdidstopselector:
method.
[uiview beginanimations:nil context:nil]; [uiview setanimationduration:0.5]; [uiview setanimationdelegate:self]; [uiview setanimationdidstopselector:@selector(animateimages)]; tapimage.center = cgpointmake(156, 110); [uiview commitanimations]; //other stuff -(void)animateimages{ [tapimage startanimating]; }
Comments
Post a Comment