Title, today's mission is nasonry introduction and use of Practice: Quick Start AutoLayout & own App project adaptation & problems encountered and solutions.
Tips: Switch between. h and. m files Shortcut control + COMMAND + up and down keys
Tips: How to set the button's properties (rounded corners and background colors) in Xib. Inspector--User Defined Runtime Attributes--Layer.cornerradius & number & 10
September 14 Update-Well, the task of last Friday was postponed to today, and today we will come to it.
// Mas_makeconstraints is only responsible for new constraints AutoLayout can not exist at the same time two for the same object constraints will be an error -(Nsarray *) mas_makeconstraints: (void(^) (Masconstraintmaker * Make)) block; // mas_remakeconstraints clears all previous constraints to keep only the most recent constraints -(Nsarray *) mas_updateconstraints: (void(^) (Masconstraintmaker * Make)) block; // mas_updateconstraints for the above situation will update the constraints appearing in the block will not result in the occurrence of two identical constraints -(Nsarray *) mas_remakeconstraints: (void(^) (Masconstraintmaker *make)) block;
The first is how to refer to a third-party library file in your project. Even when importing with cocoapods import, there is no prompt workaround:
Select Target--> User Header Search Paths-click in the space at the back. Write to the left of $ (pods_root)--> select rucursive behind. Can.
Well, it can be called.
Asked the great God, the skill get time.
For example, if I want to put this picture in the center of the Sele.view, and then the distance top50 pixels, then the code should be written like this.
Uiimageview *heads =[[Uiimageview alloc] init]; Heads.layer.masksToBounds=YES; Heads.layer.cornerRadius= -;//fillet radius?[Heads setimage:[uiimage imagenamed:@"User_head"]]; [Self.view Addsubview:heads]; [Heads mas_makeconstraints:^ (Masconstraintmaker *Make ) { make.top.equalTo (self.view). With.offset ( -); Make.centerX.equalTo (self.view); }];
It is important to note that the automatic layout is relative to the Superview and brother view, and cannot be arranged relative to itself.
So the parentheses inside the code are Self.view, not heads.
---2015-09-15 Update
The three methods mentioned above only used one of them yesterday, namely mas_makeconstraints.
I guess I just groped for something more superficial. The last example.
[Loginbutton mas_makeconstraints:^ (Masconstraintmaker * make) { Make.left.right.and.width.equalTo ( Self.view); Make.top.equalTo (Centerlabel.mas_bottom). With.offset (+); Make.height.equalTo (@); }];
As simple as this, just remember that the masonry implementation of the AutoLayout this layout is relative to the Superview and its brother view, must not want to layout themselves.
IOS Masonry Introduction and usage practices: Get started quickly autolayout