Ios – Enable iPhone Interface Orientation

interfaceiosiphoneuiinterfaceorientation

I'm trying to get my application to rotate the interface when the device itself is rotated, but I can't get it right.
I have added the supported interfaces in the plist info file and returned yes for the shouldRotateToInterfaceOrientation.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {  
    if (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight) {  
        return YES;  
    } else {  
        return NO;  
    }  
} 

Is this how rotation is implemented?
Please help!

Best Answer

Maybe try editing the info.plist and also add your supported orientations there?

Select your project --> Select your target --> Info --> Supported interface orientations and click on the plus sign 4 times to support these orientations:

Item 0   Landscape (left home button)
Item 1   Landscape (right home button)
Item 2   Portrait (top home button)
Item 3   Portrait (bottom home button)

Hope it helps!

Related Topic