IOS8 came, Xcode also upgraded to 6, but I even autolayout, even storyboard will not use.
Manual code codes are defined by the macro to adapt the interface, so when the iOS7 out of the time also did not change the UI habits. Now iOS8 out, Sizeclass AutoLayout a time overwhelming. I was half dead and I felt I was out of the way. Hurry to learn storyboard,autolayout ...
But until today finally have time to see AutoLayout, good again before, to storyboard don't understand, first read a blog
http://blog.csdn.net/u010990519/article/details/38417381, the blog through the talk of very exciting, like one!
Now create a new project, set up the following UI, if it is still not storyboard, just look at the top of the blog,
The UI is as follows:
Sizeclass Select all of the vertical screen iphone
Ok, the UI is ready, just put a label on it and try AutoLayout.
Label affixed, and began to use AutoLayout, in order to be able to replace the auto, the label added to the control in the lower right corner, through the long-term screen test.
There are tools to add constraints to the Xcode toolbar, and the storyboard panel. Note: Their order is not corresponding.
First use the storyboard panel to add a constraint that is 20 pixels from the right side of the screen:
To add a constraint:
This place has a more important place is to remove the hook, because do not remove there will be an internal margin, resulting in a label with superview more than 16 pixels away (if you set the constraint to 20, the actual is 36);
The effect after adding:
A frame that is not bound to a fixed label, and adds a constraint that is 20 pixels from the bottom of the line
I don't run the code right now like I see the effect now:
:
The width of the label is adapted to the content.
Now run to see the effect!!
The background is white, a few pieces can see the effect is the bottom right corner 20-20
Continue later ...
Xcode6 study AutoLayout A