属性
@property (nonatomic, retain) NSMutableArray * <#arrName#>;
@property (nonatomic, retain) NSArray * <#arrName#>;
@property (nonatomic, copy) NSString * <#name#>;
@property (nonatomic, retain) <#UIKitName#> * <#name#>;
@property (nonatomic, copy) <#UIKitName#> <#name#>;
Button
UIButton * <#subButton#> = [UIButton buttonWithType:(UIButtonTypeCustom)];
<#subButton#>.layer.cornerRadius = <#float Width#>;
<#subButton#>.layer.masksToBounds = YES;
[self addSubview:<#subButton#>];
[<#subButton#> setTitle:<#@""#> forState:<#(UIControlState)#>];
[<#subButton#> setTitleColor:[UIColor colorWithHexString:<#@"#"#>] forState:<#(UIControlState)#>];
[<#subButton#> setImage:[UIImage imageNamed:<#@""#>] forState:<#(UIControlState)#>];
[<#subButton#> setBackgroundImage:[UIImage imageNamed:<#@""#>] forState:<#(UIControlState)#>];
[<#subButton#> addTarget:self action:@selector(<#selector#>) forControlEvents:<#(UIControlEvents)#>];
[<#subButton#> mas_makeConstraints:^(MASConstraintMaker *make) {
make<#.left#><#.right#><#.top#><#.bottom#>.equalTo(<#length#>);
make.left.equalTo(<#view#>.mas_<#direction#>)<#.offset()#>;
make.right.equalTo(<#view#>.mas_<#direction#>)<#.offset()#>;
make.top.equalTo(<#view#>.mas_<#direction#>)<#.offset()#>;
make.bottom.equalTo(<#view#>.mas_<#direction#>)<#.offset()#>;
make.width.offset(<#width#>);
make.height.offset(<#height#>);
make.ceterX.equalTo(<#view#>.mas_centerX)<#.offset()#>;
make.ceterY.equalTo(<#view#>.mas_centerY)<#.offset()#>;
}];
Label
UILabel * <#titleLabel#> = [[UILabel alloc]init];
UILabel * <#titleLabel#> = [[UILabel alloc]init:<#fontSize#>];
<#titleLabel#>.textAlignment = <#NSTextAlignment#>;
<#titleLabel#>.textColor = [UIColor colorWithHexString:<#(NSString *)#>];
<#titleLabel#>.font = [UIFont systemFontOfSize:<#(CGFloat)#>];
[self addSubview:<#(nonnull UIView *)#>];
[<#titleLabel#> mas_makeConstraints:^(MASConstraintMaker *make) {
make<#.left#><#.right#><#.top#><#.bottom#>.equalTo(<#length#>);
make.left.equalTo(<#view#>.mas_<#direction#>)<#.offset()#>;
make.right.equalTo(<#view#>.mas_<#direction#>)<#.offset()#>;
make.top.equalTo(<#view#>.mas_<#direction#>)<#.offset()#>;
make.bottom.equalTo(<#view#>.mas_<#direction#>)<#.offset()#>;
make.width.offset(<#width#>);
make.height.offset(<#height#>);
make.ceterX.equalTo(<#view#>.mas_centerX)<#.offset()#>;
make.ceterY.equalTo(<#view#>.mas_centerY)<#.offset()#>;
}];
[<#UIView#> mas_makeConstraints:^(MASConstraintMaker *make) {
make<#.left#><#.right#><#.top#><#.bottom#>.equalTo(<#length#>);
make.left.equalTo(<#view#>.mas_<#direction#>)<#.offset()#>;
make.right.equalTo(<#view#>.mas_<#direction#>)<#.offset()#>;
make.top.equalTo(<#view#>.mas_<#direction#>)<#.offset()#>;
make.bottom.equalTo(<#view#>.mas_<#direction#>)<#.offset()#>;
make.width.offset(<#width#>);
make.height.offset(<#height#>);
make.ceterX.equalTo(<#view#>.mas_centerX)<#.offset()#>;
make.ceterY.equalTo(<#view#>.mas_centerY)<#.offset()#>;
}];
网友评论