Hello,
I'm trying to work out how to do this in my head and I'm stuck. I have a View containing 15 different UIImageViews (5 by 3) where each UIImageView shows a flipbook style animation. Covering each UIImageView there is a UIButton that when touched will become hidden revealing the new animation while ending the first animation. I only want up to 5 animation loops playing at a time (one per row). If a button is pushed selecting another animation to begin, that animation should begin only after the currently playing animation in that row is complete. "L1-L5"(below) are UILabel's I'm using to show which animations to play based on a number. Here is what I have so far:
How do I get the second animation to begin after the first one ends? I hope this kind of makes sense. Any thoughts will be greatly appreciated.
Thanks,
Nick
I'm trying to work out how to do this in my head and I'm stuck. I have a View containing 15 different UIImageViews (5 by 3) where each UIImageView shows a flipbook style animation. Covering each UIImageView there is a UIButton that when touched will become hidden revealing the new animation while ending the first animation. I only want up to 5 animation loops playing at a time (one per row). If a button is pushed selecting another animation to begin, that animation should begin only after the currently playing animation in that row is complete. "L1-L5"(below) are UILabel's I'm using to show which animations to play based on a number. Here is what I have so far:
Code:
- (IBAction)lighton1{
L1.text=@"1";}
- (IBAction)lighton2{
L1.text=@"2";}
- (IBAction)lighton3{
L1.text=@"3";}
- (IBAction)lighton4{
L2.text=@"1";}
- (IBAction)lighton5{
L2.text=@"2";}
- (IBAction)lighton6{
L2.text=@"3";}
- (IBAction)lighton7{
L3.text=@"1";}
- (IBAction)lighton8{
L3.text=@"2";}
- (IBAction)lighton9{
L3.text=@"3";}
- (IBAction)lighton10{
L4.text=@"1";}
- (IBAction)lighton11{
L4.text=@"2";}
- (IBAction)lighton12{
L4.text=@"3";}
- (IBAction)lighton13{
L5.text=@"1";}
- (IBAction)lighton14{
L5.text=@"2";}
- (IBAction)lighton15{
L5.text=@"3";}
- (void)animateImages{
UIImage *Image1 = [UIImage imageNamed:@"playbanjoguy1e.png"];
UIImage *Image2 = [UIImage imageNamed:@"playbanjoguy1f.png"];
UIImage *Image3 = [UIImage imageNamed:@"playbanjoguy1g.png"];
UIImage *Image4 = [UIImage imageNamed:@"playbanjoguy1h.png"];
UIImage *Image5 = [UIImage imageNamed:@"playbanjoguy2e.png"];
UIImage *Image6 = [UIImage imageNamed:@"playbanjoguy2f.png"];
UIImage *Image7 = [UIImage imageNamed:@"playbanjoguy2g.png"];
UIImage *Image8 = [UIImage imageNamed:@"playbanjoguy2h.png"];
UIImage *Image9 = [UIImage imageNamed:@"playbanjoguy2i.png"];
UIImage *Image10 = [UIImage imageNamed:@"playbanjoguy2j.png"];
UIImage *Image11 = [UIImage imageNamed:@"playbanjoguy2k.png"];
UIImage *Image12 = [UIImage imageNamed:@"playbanjoguy2l.png"];
UIImage *Image13 = [UIImage imageNamed:@"playbanjoguy2m.png"];
UIImage *Image14 = [UIImage imageNamed:@"playbanjoguy2n.png"];
UIImage *Image15 = [UIImage imageNamed:@"playbanjoguy2o.png"];
UIImage *Image16 = [UIImage imageNamed:@"playbanjoguy2p.png"];
if(images.image == Image1)
images.image = Image2;
else if(images.image == Image2)
images.image = Image3;
else if(images.image == Image3)
images.image = Image4;
else if(images.image == Image4)
images.image = Image5;
else if(images.image == Image5)
images.image = Image6;
else if(images.image == Image6)
images.image = Image7;
else if(images.image == Image7)
images.image = Image8;
else if(images.image == Image8)
images.image = Image9;
else if(images.image == Image9)
images.image = Image10;
else if(images.image == Image10)
images.image = Image11;
else if(images.image == Image11)
images.image = Image12;
else if(images.image == Image12)
images.image = Image13;
else if(images.image == Image13)
images.image = Image14;
else if(images.image == Image14)
images.image = Image15;
else if(images.image == Image15){
images.image = Image16;
// I think I want some code here to start the new animation
}
else
images.image = Image1;
}
-(void) guy1{
if (L1.text==@"1"){
//play sound
//hide Button
if (animationTimer2) {
[animationTimer2 invalidate];
}
if (animationTimer3) {
[animationTimer3 invalidate];
}
}else if(L1.text==@"2"){
//play sound2
if (animationTimer) {
[animationTimer invalidate];
}
if (animationTimer3) {
[animationTimer3 invalidate];
}
}else if(L1.text==@"3"){
//play sound3
}
}
- (void)tick{
[self animateImages];
}
- (void)tick2{
[self animateImages2];
}
- (void)tick3{
[self animateImages3];
}
- (void)tick4{
[self animateImages4];
}
- (void)tick5{
[self animateImages5];
}
- (void)tick6{
[self animateImages6];
}
- (void)tick7{
[self animateImages7];
}
- (void)tick8{
[self animateImages8];
}
- (void)tick9{
[self animateImages9];
}
- (void)tick10{
[self animateImages10];
}
- (void)tick11{
[self animateImages11];
}
- (void)tick12{
[self animateImages12];
}
- (void)tick13{
[self animateImages13];
}
- (void)tick14{
[self animateImages14];
}
- (void)tick15{
[self animateImages15];
}
- (void)viewDidLoad {
L1.text=@"1";
animationTimer = [NSTimer scheduledTimerWithTimeInterval:(2.0/25.0) target:self selector:@selector(tick) userInfo:nil repeats:YES];
[super viewDidLoad];
}
How do I get the second animation to begin after the first one ends? I hope this kind of makes sense. Any thoughts will be greatly appreciated.
Thanks,
Nick
Last edited: