ios - Pausing an UIImageView animation -


i doing uiimageview animation so:

//////progressbar start progressbar.animationimages = [nsarray arraywithobjects:                                [uiimage imagenamed:@"1.png"],                                [uiimage imagenamed:@"2.png"],                                [uiimage imagenamed:@"3.png"],                                [uiimage imagenamed:@"4.png"],                                [uiimage imagenamed:@"5.png"],                                [uiimage imagenamed:@"6.png"],                                [uiimage imagenamed:@"7.png"],                                [uiimage imagenamed:@"8.png"],                                [uiimage imagenamed:@"9.png"],                                [uiimage imagenamed:@"10.png"],                                [uiimage imagenamed:@"11.png"],                                [uiimage imagenamed:@"12.png"],                                [uiimage imagenamed:@"13.png"],                                [uiimage imagenamed:@"14.png"],                                [uiimage imagenamed:@"15.png"],                                [uiimage imagenamed:@"16.png"],                                [uiimage imagenamed:@"17.png"],                                [uiimage imagenamed:@"18.png"],                                [uiimage imagenamed:@"19.png"],                                [uiimage imagenamed:@"20.png"],                                [uiimage imagenamed:@"21.png"],                                [uiimage imagenamed:@"22.png"],                                [uiimage imagenamed:@"23.png"],                                [uiimage imagenamed:@"24.png"],                                [uiimage imagenamed:@"25.png"],                                [uiimage imagenamed:@"26.png"],                                [uiimage imagenamed:@"27.png"],                                [uiimage imagenamed:@"28.png"],                                [uiimage imagenamed:@"29.png"],                                [uiimage imagenamed:@"30.png"],                                [uiimage imagenamed:@"31.png"],                                [uiimage imagenamed:@"32.png"],                                [uiimage imagenamed:@"33.png"],                                [uiimage imagenamed:@"34.png"],                                [uiimage imagenamed:@"35.png"],                                [uiimage imagenamed:@"36.png"],                                [uiimage imagenamed:@"37.png"],                                [uiimage imagenamed:@"38.png"],                                [uiimage imagenamed:@"39.png"],                                [uiimage imagenamed:@"40.png"],                                [uiimage imagenamed:@"41.png"],                                [uiimage imagenamed:@"42.png"], nil]; progressbar.animationduration = 5.00; progressbar.animationrepeatcount = 0; [progressbar startanimating]; 

now need pause once user clicks button images not animate , stay on current image.

i got code off web pause it,

  uiview *viewbeinganimated = //your view being animated viewbeinganimated.frame = [[viewbeinganimated.layer presentationlayer] frame]; [viewbeinganimated.layer removeallanimations]; //when user unpauses, create new animation current position. 

will code work? how unpause current image?

i tried use code , didn't work.

instead can use code provided apple in following link pause , resume animation.

http://developer.apple.com/library/ios/#qa/qa1673/_index.html

to calayer pass pauselayer function, can use following code.

calayer *player = progressbar.layer; [self pauselayer:player]; 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -