Hi
In my app, I run numerous animations, moving objects and shapes etc.
Many of the animations lead on to the animation of other objects.
A problem with the application is that if an animation is running and you start another that involves one of the objects currently being animated, the screen goes white/we get unexpected results.
I worked up some sample code to show what we are trying to do:
So, when the animation is in progress, we would expect NO to come out of the NSLog in the console. I am checking every 0.1 seconds with the timer used above. Instead, I just get 'NO' printed through the console log.
Any ideas anybody?
Sam
In my app, I run numerous animations, moving objects and shapes etc.
Many of the animations lead on to the animation of other objects.
A problem with the application is that if an animation is running and you start another that involves one of the objects currently being animated, the screen goes white/we get unexpected results.
I worked up some sample code to show what we are trying to do:
Code:
UIButton *button;
BOOL currentlyShowingQuestion;
- (void)viewDidLoad
{
[self moveButton:button];
currentlyShowingQuestion = NO;
[NSTimer scheduledTimerWithTimeInterval:.1 target:self selector:@selector(hasBoolChanged) userInfo:nil repeats:YES];
- (void)moveButton:(UIButton *)buttonToUse {
currentlyShowingQuestion = YES;
NSLog(@"moveButton Called! Yippee!!!!!!!");
[UIView animateWithDuration:0.5 delay:0.5 options:nil animations:^{
buttonToUse.frame = CGRectMake(10, 10, 300, 440);
} completion:^(BOOL finished){
currentlyShowingQuestion = NO;
}];
}
-(void)hasBoolChanged {
if (currentlyShowingQuestion == YES) {
NSLog(@"Yes");
}
else if (currentlyShowingQuestion == NO) {
NSLog(@"No");
}
}
So, when the animation is in progress, we would expect NO to come out of the NSLog in the console. I am checking every 0.1 seconds with the timer used above. Instead, I just get 'NO' printed through the console log.
Any ideas anybody?
Sam