代码块

作者: 天往哪方 | 来源:发表于2020-05-21 14:58 被阅读0次

属性

@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()#>;
        }];

相关文章

  • 普通代码块、构造代码块、静态代码块、同步代码块

    普通代码块:在方法或语句中出现的{}就称为普通代码块。普通代码块和一般的语句执行顺序由他们在代码中出现的次序决定-...

  • Java中静态代码块,构造代码块,构造函数代码块

    Java中静态代码块,构造代码块,构造函数代码块,普通代码块 静态代码块 : static代码块指的是static...

  • 09.代码块的概述

    代码块 局部代码块 局部代码块是定义在方法或语句中 构造代码块 构造代码块是定义在类中成员位置的代码块 静态代码块...

  • Java代码块详解

    Java中代码块指的是用 {} 包围的代码集合,分为4种:普通代码块,静态代码块,同步代码块,构造代码块 普通代码...

  • java中的代码块

    java中的代码块: 普通代码块,静态代码块,构造代码块 1. 普通代码块:在方法或者语句中, …… ...

  • Java基础之普通代码块、构造代码块、静态代码块、同步代码块

    1、概念 普通代码块:在方法或语句中出现的{}就称为普通代码块。普通代码块和一般的语句执行顺序由他们在代码中出现的...

  • 代码块

    rem

  • 代码块

    案例 邮箱:ithelei@sina.cn 技术讨论群:687856230 GoodLuck

  • 代码块

    代码块:1.普通代码块,在方法中写的代码块2.构造快,在类中定义的代码块,在创建对象时被调用,优于构造方法执行3....

  • 代码块

    定义:被“{}”包括的代码片段,使代码具备独立性,一般用于实现特定算法; 分类:普通代码块、静态代码块、同步代码块...

网友评论

      本文标题:代码块

      本文链接:https://www.haomeiwen.com/subject/wrgzohtx.html