How to create different restrictions for iphone 5 and iphone 6

Is it possible to create a restriction specifically for iPhone 4 and 5 without affecting the iPhone 6?

prototype

See image above:

Scroll height with equal height with content presentation. I changed the multiplier to make it 40% of the actual cell height.

The cell represents the patch height, the same height as the main window.

If you see in the preview on the left, there is not enough space on devices 5 and 4. So I wonder how to approach this design problem.

+3


source to share


3 answers


Try using aspect ratio for all window views. It will calculate your screen size and it will automatically align to suit your constraints. I had the same problem, I got over the aspect ratio setting.



take a look, link http://mathewsanders.com/designing-adaptive-layouts-for-iphone-6-plus/

+3


source


Unfortunately, you cannot do this. The solution to your problem changes the constant

constraints. Therefore, I suggest you detect the user device here, how to do it, and change the limit value something like this:

-(void)viewWillLayoutSubviews {
    [super viewWillLayoutSubviews];

    if (IS_IPHONE_6) {
        self.verticalConstraintOfButtonToTop.constant = 22;

    } else if (IS_IPHONE_5) {
        self.verticalConstraintOfButtonToTop.constant = 17;
    }
}

      



or you can create a separate storyboard and use it.

Also you can use Size Classes

to create universal storyboard for iPhone and iPad or portrait / landscape modes.

+2


source


I do not understand your question. Maybe this will help:

Constraints are similar to other IB elements in that they can be IBOutlets. Just ctl drag from the constraint in the outline of the IB object to the appropriate view controller. In the view controller, you can tweak its values ​​in code depending on the device type.

Hope it helps.

0


source







All Articles