ios - Delay between animation cycle on a UIImageView -
i have uiimageview
called imgview, have array of images, like,
imagearray objects: [uiimage imagenamed:@"test4.png"], [uiimage imagenamed:@"test5.png"], [uiimage imagenamed:@"test6.png"], [uiimage imagenamed:@"test7.png"], nil];
then have added array images in imgview animation, like
imgview.animationimages = imagearray; imgview.animationrepeatcount = 0; imgview.animationduration = 2.0f; [imgview startanimating];
here every thing works fine. have delay 5sec after 1 cycle of animation finishes. how can this, have used
[self performselector:@select...
but not working, please give me idea.
try this:
-(void) viewwillappear:(bool)animated { [super viewwillappear:yes]; [self animationmethod]; //where start animation } -(void) animationmethod { nsmutablearray *imagearray = [[nsmutablearray alloc] initwithobjects:[uiimage imagenamed:@"btnvideoeffectsample1.png"], [uiimage imagenamed:@"btnvideoeffectsample2.png"], [uiimage imagenamed:@"btnvideoeffectsample3.png"], [uiimage imagenamed:@"btnvideoeffectsample4.png"], nil]; imgprofilepicture.animationimages = imagearray; imgprofilepicture.animationrepeatcount = 0; imgprofilepicture.animationduration = 2.0f; [imgprofilepicture startanimating]; [imagearray release]; double delaytostopanimation = 2.0; dispatch_time_t starttime = dispatch_time(dispatch_time_now, delaytostopanimation * nsec_per_sec); dispatch_after(starttime, dispatch_get_main_queue(), ^(void){ [imgprofilepicture stopanimating]; double delaytorestartanimation = 5.0; dispatch_time_t starttime = dispatch_time(dispatch_time_now, delaytorestartanimation * nsec_per_sec); dispatch_after(starttime, dispatch_get_main_queue(), ^(void){ [self animationmethod]; }); }); }
Comments
Post a Comment