My main job this week was to start the development of iOS. I also bought a new Mac, and when I started developing iOS I found a problem with the layout, models, iphone4,4s, 5,5s,6, 6plus maddening.
So many versions, if one for writing that would be too troublesome to be too troublesome, so I think of the Android Dp,ppi but not in iOS, fortunately iOS has been a different screen for this model to do the job.
Let me introduce you to the use of relative layouts in Interface Builder in Xcode:
First I create a blank project
Click on the. xib file or the storyboard layout file, and drag the controls from the toolbar on the right to the layout file to layout them.
Click on the tab above to change the toolbar type
The focus is on the relative layout of the Constraints add control-click Controls to drag to add constraints you want to add constraints to yourself (such as controlling the width of the control) and drag to yourself.
On the right side of the toolbar see descendant Constraints is the constraint you added click to modify
Interfaces such as Iphone6 and iphone4s
I designed the fashion above the red button with the top left to the right bottom of the distance fixed, so on any screen red button will be horizontally filled with the screen, look at the bottom of the two small buttons below the right button is always snapped to the bottom right of the screen, The lower left button always snaps to the bottom left of the screen. That's relative layout. I hope it helps everyone.
iOS Auto layout