views:

752

answers:

3

Can anyone confirm that [[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait]; will get your app rejected by Apple.

Is there a good replacement available?

+2  A: 

Hi,

[[UIDevice currentDevice] setOrientation:UIInterfaceOrientation] is a private API, you can find that is signature is only in read-only (see here).

If you want set the device orientation to Portrait or other mode you should override the shouldAutorotateToInterfaceOrientation:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation == UIDeviceOrientationPortrait);
}
Yannick L.
UIDevice is not a private API.
thierryb
Yes sorry, it's a mistake, I'd just tell that the setOrientation is private.
Yannick L.
A: 

You can add UIInterfaceOrientation in your app plist

thierryb
A: 

Yes you'll get rejected.

You can change the frame and apply a transformation to the key window, and change the status bar orientation (which is public) to simulate changing the orientation.

KennyTM