Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iphone xcode Landscape mode by default

Tags:

iphone

how can I set an iphone app to start in Landscape mode? and stays that way

like image 467
Comma Avatar asked Aug 11 '26 23:08

Comma


2 Answers

Set the "Initial interface orientation" app.plist entry to "Landscape" (left or right home 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);
}
like image 97
Marcelo Cantos Avatar answered Aug 14 '26 14:08

Marcelo Cantos


Marcelo's answer is not correct, because UIInterfaceOrientationLandscape is not a valid identifier and thus brings up a build fail.

progrmr's answer 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...)


Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!