views:

26

answers:

0

Hi,

I want to build a glowing (pulsing) animation on a simple UIImageView. The ImageView will grow a little bit bigger, then goes back to original size.

I used following code:

- (void) doCoolAnimation {
    [UIView beginAnimations:@"glowingAnimation" context:nil];
    [UIView setAnimationRepeatAutoreverses:YES];
    [UIView setAnimationRepeatCount:INT_MAX];
    [UIView setAnimationDuration:0.25];
    [UIView setAnimationBeginsFromCurrentState:YES];
    imageView.transform = CGAffineTransformMakeScale(1.15, 1.15);
    [UIView commitAnimations];
}

This works fine on iOS3 but works only partially on iOS4.

I have a UITabBarController with 2 views in it. In the first one, is the imageView with the animation and the animation starts as soon as the view is loaded. But after I switch to the second view (using TabBar) and back, the animation is not running anymore on iOS4. (But on iOS3 I can switch between these 2 views and the animation still works fine)

I also tried with an timer, that calls doCoolAnimation every second, but that does not help to start the animation again.

Can someone please help me? Can someone explain why after view switching the animation is gone? Can someone tell me some workaround how I can make it work on iOS4?

Thanks in advice, Buju