iPhone programming: How to force your app to run in landscape mode

As you may have mentioned, lot of iPhone apps (especially games) run by default in landscape mode! You can easily force the app you develop to run in landscape mode! Let’s see how:

  1. In Xcode find the file [YourAppName]-Info.plist and open it up.
  2. Right click on the table and select “Add Row”. Select “Initial interface orientation” and set the value to Landscape (left or right).
  3. Right click again and add Status bar is initially hidden.This is optional, it has nothing to do with view orientation, but it will hide the status bar.
  4. Open [YourAppName]ViewController.m file and uncomment the following:
  5. Change the code you just uncommented to look like this:

    Parameter interfaceOrientation == UIInterfaceOrientationLandscapeRight starts the app with the Home button at the right side. interfaceOrientation == UIInterfaceOrientationLandscapeLeft starts the app with the Home button at the left side. Set the same landscape orientation that you’ve set in Info.plist file.

One thought on “iPhone programming: How to force your app to run in landscape mode

Leave a Reply

Your email address will not be published. Required fields are marked *