如何在动画执行时等待(how to wait while animation is performing)

编程入门 行业动态 更新时间:2024-10-22 18:50:06
如何在动画执行时等待(how to wait while animation is performing)

我有两个图像视图,称为动画和指令动画图像视图用于播放动画和指令图像视图用于显示指令

我希望在我的动画完成后这样做,然后我想要更改指令图像视图的图像

-(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event{ if(event.subtype == UIEventSubtypeMotionShake) { NSMutableArray *array = [[NSMutableArray alloc] init]; for(int i=1;i<=20;i++){ [array addObject:[UIImage imageNamed:[NSString stringWithFormat:@"vivacious%d.png",i] ] ]; } self.animation.animationImages = array; self.animation.animationRepeatCount = 1;//0 for infinite loop self.animation.animationDuration = 1.5; [self.animation startAnimating]; //[NSThread sleepForTimeInterval:1.5]; self.instruction.image = [UIImage imageNamed:@"ah.png"]; } }

i have two image view, called animation and instruction animation image view for play animation and instruction image view for display instruction

i want to do that when my animation is finished then i want change the image of instruction image view

-(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event{ if(event.subtype == UIEventSubtypeMotionShake) { NSMutableArray *array = [[NSMutableArray alloc] init]; for(int i=1;i<=20;i++){ [array addObject:[UIImage imageNamed:[NSString stringWithFormat:@"vivacious%d.png",i] ] ]; } self.animation.animationImages = array; self.animation.animationRepeatCount = 1;//0 for infinite loop self.animation.animationDuration = 1.5; [self.animation startAnimating]; //[NSThread sleepForTimeInterval:1.5]; self.instruction.image = [UIImage imageNamed:@"ah.png"]; } }

最满意答案

-(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event{ if(event.subtype == UIEventSubtypeMotionShake) { NSMutableArray *array = [[NSMutableArray alloc] init]; for(int i=1;i<=20;i++){ [array addObject:[UIImage imageNamed:[NSString stringWithFormat:@"vivacious%d.png",i] ] ]; } self.animation.animationImages = array; self.animation.animationRepeatCount = 1;//0 for infinite loop self.animation.animationDuration = 1.5; [self.animation startAnimating]; self.instruction.hidden = YES; [NSTimer scheduledTimerWithTimeInterval:1.5 target:self selector:@selector(changeInstruction) userInfo:nil repeats:NO]; } } -(void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event{ if(event.subtype == UIEventSubtypeMotionShake) { NSMutableArray *array = [[NSMutableArray alloc] init]; for(int i=1;i<=20;i++){ [array addObject:[UIImage imageNamed:[NSString stringWithFormat:@"vivacious%d.png",i] ] ]; } self.animation.animationImages = array; self.animation.animationRepeatCount = 1;//0 for infinite loop self.animation.animationDuration = 1.5; [self.animation startAnimating]; self.instruction.hidden = YES; [NSTimer scheduledTimerWithTimeInterval:1.5 target:self selector:@selector(changeInstruction) userInfo:nil repeats:NO]; } }

更多推荐

本文发布于:2023-08-07 10:04:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1463784.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:动画   如何在   wait   animation   performing

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!