Nimrod Yizhar
Nimrod Yizhar

Reputation: 381

iCarousel disables any other animation done in the background

I am using Nick Lockwood's iCarousel to display images, and I need to make a transition between backgrounds behind the carousel when the carousel stops at an image. I am using UIView's animateWithDuration, and the problem is that the animation completion happens instantly because iCarousel is calling [CATransaction setDisableActions:YES];

I deleted the call to disableAnimation and enableAnimation in Step method of iCarousel, and now my transition animation works fine, but I'm afraid some functionality will be missing or strange bugs will occur now.

can anybody concur or suggest a different approach for this?

Upvotes: 0

Views: 306

Answers (1)

Nick Lockwood
Nick Lockwood

Reputation: 40995

The [CATransaction setDisableActions:YES] is partly for Mac support and partly to prevent weird resizing effects when item views are loaded. If you aren't seeing any problems then it's probably safe to disable those lines, but you're generally better off not modifying the library if you don't have to as it makes it more difficult to upgrade to a new release later.

When are you triggering your animation? If you only want it to happen when the carousel comes to a stop, the correct place to do it is probably in the

- (void)carouselDidEndScrollingAnimation:(iCarousel *)carousel;

Delegate method. If you do it there you shouldn't have problems with the animation being stopped. If you are already doing it there, and you are still seeing problems then a workaround is to delay your animation until the next runloop update, which you can do using GCD, like this:

dispatch_async(dispatch_get_main_queue(), ^{    
    //perform your animation code
});

Upvotes: 1

Related Questions