How to handle iPhone 4s, 5, and 6 screen sizes and make all content the same across all devices

I am using Xcode 6.1 and in one of the views I have it contains many shortcuts. However, these shortcuts look different on each of the different devices. Although I am adding constraints for all shortcuts, I still face the same problem.

How can I get the same view layout across all devices? How can I make the width and height of each label flexible depending on the screen size? Do I need to create different xibs for each device?

The following images showing the result are obtained with automatic resizing and constants enabled.

on iPhone 6 enter image description here

on iPhone 5

enter image description here

on iPhone iOS 7.1 enter image description here

+3


source to share


4 answers


We have provided a simple solution. By using Aspect Ratio Constraint , we can get a relative appearance across all device screens.

I had the same problem and found this -> http://mathewsanders.com/designing-adaptive-layouts-for-iphone-6-plus/



Therefore, when designing with a minimum and high screen resolution, we cannot set a specific width and height for all controls, as this may seem strange. Thus, using this constraint, we can have a relative view for all screens.

If you don't want to use constraints or want to keep the same width and height, you can add a scrollview to hold all the controls. For this, you can set a change frame for the scrollview with a fixed content size.

+4


source


To solve this problem...

1) Go to xib file and uncheck "Automarket"

enter image description here



2) Then set the automation manually as follows for each peep.

enter image description here

+1


source


Use self.view.bounds.size.width

to get the screen width, then use a relative value to initialize all labels.

0


source


One soul is that you can create a story board for each screen size like for iphone 5, one for iphone 6 and one for iphone 6+, and in your AppDelegate method "didFinishLaunchingWithOptions" you can get the screen size and popup storyboard in this case you can set different limits depending on the screen size

0


source







All Articles