Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Programmer

macrumors member
Original poster
Jun 16, 2009
79
0
In my application I have a UIImageView and a Button over it. I have a button to start the animation which then Sets an ImageDidAppear BOOL to YES and starts a timer with the same length as the animation. When the timer goes off it sets the ImageDidAppear BOOL to NO. My button only responds if the BOOL = YES. The button stops the animation and also sets the ImageDidAppear BOOL to NO.

The problem is that for some reason the Image shows up in the UIImageView but you can't tap the button to stop the animation or at least when you do hit it , it doesn't work.

Help Please
 
put a print command in there to check that you have atleast set up the IBAction to the button, so when you press it make sure the print command appears, then you are able to see where its most likly to be going wrong
 
i'v tried that

i've already tried that. and when i take out the timer it works fine but i need the timer to work for my application
 
In my application I have a UIImageView and a Button over it. I have a button to start the animation which then Sets an ImageDidAppear BOOL to YES and starts a timer with the same length as the animation. When the timer goes off it sets the ImageDidAppear BOOL to NO. My button only responds if the BOOL = YES. The button stops the animation and also sets the ImageDidAppear BOOL to NO.
Care to include some code snippets? Because I'm a little confused. If the button only responds if the BOOL == YES, but you "have a button to start the animation which then Sets an ImageDidAppear BOOL to YES", how can the BOOL ever get set to YES?
 
Heres the code

- (IBAction)Start {
right1Appaered = YES;

[NSTimer scheduledTimerWithTimeInterval:5 target:self selector:mad:selector (right1) userInfo:nil repeats:NO];

right1.animationImages = [NSArray arrayWithObjects:

//Image Animation Here

[right1 setAnimationRepeatCount:1];
right1.animationDuration = speed;
[right1 startAnimating];


- (IBAction)right1 {
if (right1Appaered) {
right1Appaered = NO;
Left1Appaered = YES;

[right1 stopAnimating];


}
}
 
So, you have one button that when you first tap it, starts the animation and then, while the animation is going, you want to tap the button again to stop the animation, is that correct?
 
Sorry this is the code

i forgot the closed curly bracket.

- (IBAction)Start {
right1Appaered = YES;

[NSTimer scheduledTimerWithTimeInterval:5 target:self selector:mad:selector (right1) userInfo:nil repeats:NO];

right1.animationImages = [NSArray arrayWithObjects:

//Image Animation Here

[right1 setAnimationRepeatCount:1];
right1.animationDuration = speed;
[right1 startAnimating];

}



- (IBAction)right1 {
if (right1Appaered) {
right1Appaered = NO;
Left1Appaered = YES;

[right1 stopAnimating];

}
}
 
yes

yes i'm sure like i said everything works if i don't have the timer but i need the timer.
 
What happens if you give your UIImageView and your IBAction different names? Right now they are both right1. That's confusing (to me, at least, probably also to the compiler).
 
It Worked?

sorry it took so long to get back.

I tried what you said and it worked but my question is why does that make the Timer work?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.