代码块创建Label

来源:互联网 发布:守望先锋网络质量显示 编辑:程序博客网 时间:2024/06/05 04:51



-(UILabel *)label2{

    

    if (!_label2) {

        

        _label2 = ({

            _label2 = [[UILabel alloc] init];

            _label2.frame = CGRectMake(0, 300, 100, 40);

            _label2.text = @"label2";

            _label2.backgroundColor = [UIColor redColor];

            _label2;

        

        });

        

    }

    return _label2;

    

}

0 0