Source of UIView Implicit Animation delay?

Posted by iPhoneToucher on Stack Overflow See other posts from Stack Overflow or by iPhoneToucher
Published on 2010-02-25T05:48:52Z Indexed on 2010/03/16 5:06 UTC
Read the original article Hit count: 388

I have a block of UIView animation code that looks like this:

[UIView beginAnimations:@"pushView" context:nil];
[UIView setAnimationDelay:0];
[UIView setAnimationDuration:.5];
[UIView setAnimationDelegate:self];
[UIView setAnimationWillStartSelector:@selector(animationWillStart)];

view.frame = CGRectMake(0, 0, 320, 416);
[UIView commitAnimations];

The code basically mimics the animation of a ModalView presentation and is tied to a button on my interface. When the button is pressed, I get a long (.5 sec) delay (on iPod Touch...twice as fast on iPhone 3GS) before the animationWillStart: actually gets called. My app has lots going on besides this, but I've timed various points of my code and the delay definitely occurs at this block. In other words, a timestamp immediately before this code block and a timestamp when animationWillStart: gets called shows a .5 sec difference.

I'm not too experienced with Core Animation and I'm just trying to figure out what the cause of the delay is...Memory use is stable when the animation starts and CoreAnimation FPS seems to be fine in Instruments. The view that gets animated does have upwards of 20 total subviews, but if that were the issue wouldn't it cause choppiness after the animation starts, rather than before? Any ideas?

© Stack Overflow or respective owner

Related posts about cocoa-touch

Related posts about iphone