Chetan Hedamba
Chetan Hedamba

Reputation: 291

How to use same storyboard with proper view in both iPhone and iPad?

I want to create a app for both iPhone and iPad. Is there any easy way for that so i don't need to create two different storyboard for iPhone and iPad? How can i change whole app font size and view height and width automatically when app run in iPad and iPhone.

Upvotes: 0

Views: 1009

Answers (2)

Blazej SLEBODA
Blazej SLEBODA

Reputation: 9925

Solution:

Default Main storyboard is used by iPhone and iPad devices. To differentiate the app design a developer has a tools like Size Classes, Auto-Layout, UITraitCollection and more

Extra informations:

A default app template in Xcode builds for iPhone and iPad device.

Build Settings

TARGETED_DEVICE_FAMILY = 1,2 //iPhone = 1, iPad = 2

Default iPhone/iPad Storyboard is defined in Info.plist with key UIMainStoryboardFile . There is another key UIMainStoryboardFile~iPad which sets a storyboard file for an iPad.

Upvotes: 1

Carla Camargo
Carla Camargo

Reputation: 582

You should look for Size Classes. They are the more recommended way to do that :) Take a look at this article https://www.bignerdranch.com/blog/designing-for-size-classes-in-ios/

Upvotes: 1

Related Questions