Hi,
I have two simple animations (png images running in sequence).
Each animation has transparent backgound, so the background never changes.
I have two buttons used to initiate the animations. It all works dandy, however I'm trying to make the app work so when one animation is running, and the second button is pushed, first animation stops. Second starts. Currently the first keeps running until finish. It needs to stop when second is intiated. Any thoughts would be greatly appreciated. Code sample below.
Thanks a ton for any feedback.
I have two simple animations (png images running in sequence).
Each animation has transparent backgound, so the background never changes.
I have two buttons used to initiate the animations. It all works dandy, however I'm trying to make the app work so when one animation is running, and the second button is pushed, first animation stops. Second starts. Currently the first keeps running until finish. It needs to stop when second is intiated. Any thoughts would be greatly appreciated. Code sample below.
Code:
- (IBAction)buttonPressed1:(id)sender
{
int x=2;
if (x=2){
NSLog(@"%i", x);
UIImageView* aView = [[UIImageView alloc] initWithFrame:self.view.frame];
aView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"01.png"],
.....(many more pngs)......
aView.animationDuration = 2.00;
[aView startAnimating];
[self.view addSubview:aView];
[aView release];
}
}
- (IBAction)buttonPressed2:(id)sender
{
int x=1;
if (x=1){
NSLog(@"%i", x);
UIImageView* aView = [[UIImageView alloc] initWithFrame:self.view.frame];
aView.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"02.png"],
.....(many more pngs)......
aView.animationDuration = 2.00;
[aView startAnimating];
[self.view addSubview:aView];
[aView release];
}
}
Thanks a ton for any feedback.