当直接设置
label.layer.cornerRadius = 2.f;
是没有圆角效果的。
同时需要设置
label.clipsToBounds = YES;
或者
label.layer.masksToBounds = YES;