Reputation: 1139
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.
Upvotes: 5
Views: 842
Reputation: 1
I also made the experience that shouldAutoRotateToInterfaceOrientation is calles always twice. Interesting detail: My experience was, that self.view.frame in the first call holds the "old" values ( from where it cames ) and in the second call the "new" values (where it goes)
Upvotes: 0
Reputation: 4793
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.
Upvotes: 1