02-懒加载(OC-Swift)
2017-02-26 本文已影响13人
默默学习
OC
-(UILabel *)lb_title {
if (_lb_title == nil) {
_lb_title = [[UILabel alloc]init];
}
return _lb_title;
}
Swift
var lb_title = {
let lb = UILabel.init()
return lb
}()