Varun Chaudhary
Varun Chaudhary

Reputation: 357

Device-specific orientation for universal app

I have a universal app. I want my app to work in both orientation modes in iPhone but in portrait mode only for iPad,

How can this be done?

setOrientationtion is not responding in iOS5.

Upvotes: 1

Views: 347

Answers (4)

TCvetkovic
TCvetkovic

Reputation: 118

You can set up orientation for each device in Xcode's project settings editor.

Xcode project settings

Upvotes: 2

Girish
Girish

Reputation: 4712

  1. Go to target window.
  2. Click on Summary tab.
  3. iPhone/iPad Deployment info -> Set the supported interface orientations for iPhone & iPad as per your requirement. which solves your problem without doing a single line of code.

Upvotes: 2

Shekhar Gupta
Shekhar Gupta

Reputation: 6218

This will help you:

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
  // The device is an iPad running iPhone 3.2 or later.
  // Rotate to landscape
}
else {
  // The device is an iPhone or iPod touch.
  // Rotate to portrait
}

Upvotes: 2

Divya
Divya

Reputation: 818

Try the shouldAutorotateToInterfaceOrientation: method for ios5 and before.

Upvotes: 0

Related Questions