A.I.A.
A.I.A.

Reputation: 189

Create view for iPad out of existing views suitable for iPhone

To put it simply, my app has two main views: the first serves to choose some values, the second displays a report. Both are TableView based. The app looks well on iPhone with any screen size and for any orientation, but since the app’s thought to be universal, I want to get rid of those gaps between elements when the app runs on iPad.

I decided to have the app displaying both views on iPad screen simultaneously as official YouTube app does:

view containers in different iPad orientations

(1) and (2) are the first and the second View controller.

I see it this way:

1) Some initial view controller (additional navigation view controller?) checks idiom (iPhone / iPad) and chooses the next viewController. If idiom is iPhone, the first view controller is pushed.

2) If idiom is iPad, the «new» view controller is pushed. It has two view containers containing the fist view and the second view. Containers have autolayout constraints etc.

Questions:

1) Is it a right idea in context of Apple app design philosophy? What’s the better way to create iPad view combining existing ‘iPhone’ views?

2) Where to check for device type? Shall I use the second storyboard or something? Maybe there’s a good tutorial for this case, I didn’t find one.

Thanks in advance!

Upvotes: 0

Views: 79

Answers (1)

Jeef
Jeef

Reputation: 27275

For the 2nd part of your question I think you want to look into

I think you want to look into Size Classes and Auto Layout

enter image description here

You can make a single view but depending on the size / orientation of the device - you can enable/disable certain components of the view.

You can pin views so that in portrait you have your 1st layout and in a landscape you have your 2nd layout.

With regards to your 1st question - you do have the ability to embed a view inside of another view

enter image description here

I'm not sure if this is what you are looking for - but as far as what apple is pushing I believe size classes is what they "suggest". You can do a lot. The only thing is make sure you turn on the assistant editor into storyboard preview mode it will help a lot.

Upvotes: 1

Related Questions