I’m developing an iPhone application. Is there any default state/accessor in UIViewController that tells if orientation is in progress?
Currently I have done the following:
A BOOL member in subclass of UIViewController say isOrientationChangeInProgress
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
isOrientationChangeInProgress = YES;
}
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
isOrientationChangeInProgress = NO;
}
Is there any better way?
Apple advises starting any animations in
willRotateToInterfaceOrientation:duration:, so he rotation happens soon after that method is called. The duration property tells you how long it takesdidRotateFromInterfaceOrientation:is called once the rotation is finished, or about duration seconds later.So, I suppose your BOOL is the best thing to to do in hindsight. I don’t understand why you need to know this though; maybe your desired outcome can be achieved a different way. What are you trying to do?