Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iphone autorotation animation

Is it possible to turn off the animation for the autorotation? I want it to rotate, but I just dont want the animation to occur (like an instant switch).

like image 703
Brodie Avatar asked Dec 22 '22 02:12

Brodie


1 Answers

If you really need to, just use setAnimationsEnabled of UIView:

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    [UIView setAnimationsEnabled:NO]; // disable animations temporarily
}

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
    [UIView setAnimationsEnabled:YES]; // rotation finished, re-enable them
}

It does the trick for me. Of course it's not recommended to do this unless you have a very good reason to do it.

like image 96
ySgPjx Avatar answered Jan 04 '23 21:01

ySgPjx