Use Masonry to Compile Auto Layout-configure Masonry and masonrylayout-in pure code mode --
Auto Layout is very awesome, right? However, apple's default method of writing Auto Layout with code is too bad... The same nightmare!
But as a hand (also) code (love) Love (installed) Good (X), using StoryBoard is obviously not our dish!
By the way, I forgot to say that SizeClass is cool and uses IB, but don't worry. We should at least adapt to iOS7, that is, size Class has been very popular for some time, so there will certainly be a great God (or you) to find out the Size Class code solution!
Let's get back to code Auto Layout.
Native is too troublesome to discuss.
The two good packages I know are Masonry and pure layout. But check out git, and PureLayout has not been updated for more than half a year! Therefore, we will not consider it. Next we will introduce the use of Masonry.
You can download the sample code from github.
The readme contains the installation process.
Or you can view my files.
1. Compile Podfile
Pod 'masonry'
2. Go to the Podfile directory, and then run pod install for automatic installation.
3. Define a macro in any global location (or in any file, so you can use it anyway)
# Define MAS_SHORTHAND
4. Introduce the header file
# Import "Masonry. h"
At this point, the configuration is complete.