Auto layout iOS does not work correctly Xcode 8.2

2

I'm developing an App in Xcode 8.x.

I have a problem resizing 4 buttons on the first screen. I work on the design of iPhone 5 or 6 and I set up all the auto layout, when I squeeze all the devices it's cool except on the Iphone 4 where I can open on the Ipad, but the buttons on the resize just goes up, I wanted a suggestion on where I'd be going, I'm using the auto layout as follows, I click the right and drag to the side and use the horizontal space etc. and successively.

view the images:

    
asked by anonymous 01.11.2017 / 01:44

2 answers

1

Well, an alternative for you to be able to display the last button on iPhone 4 is to use a TableView with static cells :

And if your list of items increases, you will no longer have this problem with this iPhone model.

    
06.11.2017 / 04:16
0

Friend, it's hard to give any suggestions from Autolayout ... where there are several ways you can come up with a result.

One alternative would be to try to configure the layout from the iPhone 4s, and let iOS and constraints adapt to the other devices.

As follows:

Onceyourlayout"snaps" into the size of the iphone 4s, the rest will work.

As for the size of the buttons, try using height based on screen size ... it's a bit of a boring job, but it's a pretty good solution. I've used it several times. Just do it for a button, and give an equal height to the other.

Type this:

1 - Equals height of the view in question equal to the height of the superview

2-Gototheconstraintthatyoujustcreated,andclickedit:

3-Inthemultiplierattribute,youselectthemultiplierofthisconstraint.Thevalueworksasapercentage.Being0:zeropercent;and1:100%.InmyexampleIput12%ofthescreensize,thatis0.12.

After this, you could leave the other buttons with the same height as the button you just changed.

Anyway ... that's it. Hope it helps.

JLU.

    
12.12.2017 / 18:22