I am working on iOS 5 targeted project. I am having the orientation method as follows.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
NSLog(@" My Orientation");
return YES;
}
However, when my app is launched, my log message will be displayed twice on console, i.e. My Orientation
will be displayed twice. I am testing my app in simulator and this is happening just on launch without even changing the orientation
and then again even on changing the orientation. i.e.,
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
is getting called twice every time, which I suppose is not a correct behavior.Any help is
appreciated.
This is nothing you have done. Apple has made the device react to this many times. It just depends on what the app is doing. Perhaps a view load, or something else causes it to fire again. However, is this really a problem? In most cases, it is not (Or at least shouldn't be).
If it really is a problem, then perhaps someone should elaborate. However, at least from my experience, this is common behavior. I am not aware of any way to solve this.
I suppose if this really bothers you and there is no way to fix, you could file a bug to Apple.