views:

351

answers:

0

Hey guys,

When I return NO from my shouldAutorotateToInterfaceOrientation: method in my view, my beginAnimations doesn't animate anymore! The code looks something like this:

-  (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation {
return (UIInterfaceOrientationIsPortrait(interfaceOrientation));
}

- (void) updateRotation {
UIView * rotateThis = [[self.navigationController visibleViewController] view];

double rotation = 0;

[UIView beginAnimations: nil context:nil];
[UIView setAnimationDuration:1.0];

if(viewShouldRotate){
    rotation = M_PI;
} else {
    rotation = 0;
}

rotateThis.transform = CGAffineTransformMakeRotation(rotation);

[UIView commitAnimations];
}

So when updateRotation rotates, I don't see an animation while rotating if shouldAutorotate returns NO, while when it returns YES, I see a nice animation when updateRotation rotates. Of course, I'd like to see the animation regardless of what shouldAutorotate returns.

Thanks in Advance,