I need to implement both variants of my Portrait orientation in iPad app.
I am using the code shown below to implement both Portrait
and PortraitUpsideDown
orientations.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrai开发者_JS百科t || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
}
But orientation does not change when Orientation is PortraitUpsideDown.
What could be wrong?
Got it working.
Added both the variants of Portrait Orientations to Supported Interface Orientation
to my info.plist for my app.
This has worked for me.
Hope this helps everyone.
you could use
return UIDeviceOrientationIsPortrait(interfaceOrientation)
which is just a macro for what you're trying to get.I'm not sure both will work on simulator.
精彩评论