views:

186

answers:

2

I have an core animation block where I call a method that will load a view controller. there is an custom transition between two view controllers happening. However, when the view controller builds up the interface, all this stuff is affected by core animation. Although it results in some interesting effects, I don't want that ;)

[UIView beginAnimations:@"jump to view controller" context:self];
[UIView setAnimationDuration:0.55];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];

// some animated property-changes here...

[self loadViewControllerForIndex:targetIndex]; // everything that happens in this method shall not be animated

UIViewController *controller = [viewControllers objectAtIndex:targetIndex];
[controller viewWillAppear:YES];
[controller viewDidAppear:YES];

[UIView commitAnimations];

Unfortunately I can't move that part out of the block.

+2  A: 

You should be able to suppress animations for a section of the UIView animation block by wrapping that section in a CATransaction and disabling animations for it:

[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];    

// Changes to disable animation for here
[CATransaction commit];
Brad Larson
A: 

Try UIView animation in a sub-block:

[UIView beginAnimations:nil context:nil];
[UIView setAnimationsEnabled:NO];

//Stuff you want to happen w/o animations

[UIView commitAnimations];
Andrew Pouliot