Iphone xcode default landscape mode

How can I configure my iphone app to run in landscape mode? and remains this way

+2


a source to share


2 answers


Set the app.plist entry Initial Interface Orientation to Landscape (Left or Right button) and add (or more likely uncomment and edit) the following view controller method:



- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}

      

+7


a source


Marcelo's answer is incorrect because it is UIInterfaceOrientationLandscape

not a valid identifier and therefore causes the build to fail.

Answer to

progrmr is correct:



return interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight;

      

(Apologies for not commenting on the first answer, but I didn't have enough reputation points when I wrote this ...)

+6


a source







All Articles