StoneBreaker
StoneBreaker

Reputation: 723

iPad orientation change - How to animate load of new nib/xib

In a UIViewController am detecting the view's change in orientation using didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation. I then load a nib that corresponds to the correct device orientation using [[NSBundle mainBundle] loadNibNamed: owner: options:]. Works ok, but is a little clunky looking. Is there a way of animating the change? Thanks.

Upvotes: 0

Views: 695

Answers (1)

The WebMacheter
The WebMacheter

Reputation: 1776

You can wrap your change with a beginAnimations, like this:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown
                         forView:window cache:YES]; // You can change the effect
    /*
     * YOUR CODE HERE
     */
[UIView commitAnimations];

Upvotes: 1

Related Questions