Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Universal application with Portrait orientation for iPhone and Landscape orientation for iPad

I'm creating a Universal application using Swift. I have used Storyboard and Auto-Layouts. Requirement is of creating a universal application which will support Portrait orientation only for iPhone and Landscape orientation only for iPad.

I have developed UI for iPhone and now I will be starting iPad UI.

Also UI created for iPhone is not same as UI created for iPad, both UI's are quite different.

I'm thinking of to create separate storyboards for iPhone and iPad. Is there any proper way to achieve this?

like image 426
user1988 Avatar asked Jan 05 '15 15:01

user1988


People also ask

Can you rotate iPhone Apps on iPad?

Answer: A: For compatible Apps that are intended for iPhone, iPadOS15 will now automatically rotate the App to display in Landscape screen orientation. There is no manual configuration or setting to enable this feature.

How do I force an app to landscape on iPad?

Make sure that Rotation Lock is off: Swipe down from the top-right corner of your screen to open Control Center. Then tap the Rotation Lock button to make sure it's off.

Why do some Apps only work in portrait on iPad?

Some Apps may only support one or other screen mode - and will always launch in this mode if the other is not supported. Where both screen modes are supported by an App, then they should open in the orientation determined by the physical position of the iPad - as determined by the internal sensors of the device.

How do I force an app to rotate on iPhone?

Check Rotation Lock On an iPhone with a Home button, swipe up from the bottom of the screen to access it. On an iPhone without a Home button, swipe down from the top-right corner of the screen instead. Here, tap on the rotation lock icon (which looks like a lock with a circular arrow) to turn it on or off.


2 Answers

Go to the info.plist file and add an array with key "Supported interface orientations (iPhone)" and add the following values in it:

  1. Portrait (bottom home button)

Similarly, add another array "Supported interface orientations (iPad)" and add the following:

  1. Portrait (bottom home button)
  2. Landscape (left home button)
  3. Landscape (right home button)

See below: enter image description here

like image 152
Hamza Azad Avatar answered Oct 05 '22 20:10

Hamza Azad


If you are deploying your App to iOS 8 only, then I would use one storyboard. It is simpler to utilize one screen. Here is a link for a great tutorial. http://www.raywenderlich.com/83276/beginning-adaptive-layout-tutorial
If you are like me and want to target down to iOS 6, then I would use separate storyboards. Definitely stick with Auto Layout for whatever you decide to use.
Don't forget we must start supporting 64-bit.
Good luck!

like image 44
Murat Zazi Avatar answered Oct 05 '22 19:10

Murat Zazi