How to AutoLayout buttons in uiview controller in iphone?
I have a size of 4 inches and I added 4 icons on 3 different lines, all equal in size 60x60. I can have correct representation in iphone 4s, 5,5s, but not in iphone 6 and 6 plus. So how can I apply auto layout to it and make the icons bigger and the same in iphone 6 and 6 plus. Can this be done without any coding?
Like this
These buttons need to resize on iphone 6 and 6 plus ie to make it bigger and properly aligned. Is it possible without coding?
+3
source to share
1 answer
simple example:
- drag the button from the object library to the viewcontroller in the storyboard
- ctrl drag from your button to your view (drag left or right) and select the center vertically in the container
- ctrl drag from your button to your view (drag up or down) and select the center horizontally in the container
- ctrl drag From button to button (yes, same button) and select aspect ratio
- in the sizing inspector check the button proportion limit to have a 1: 1 multiplier
- ctrl drag from your button to your view (drag left or right) and select equal widths
- in the size inspector check the width limit of the button for a 1: 3 multiplier (or whatever you like - 1: 3 means the button width is one third of the view width)
which it should be. good luck! :)
+1
source to share