iOS的label如何既有边框又有背景色

UILabel *label = [[UILabel alloc] init];

label.backgroundColor = [UIColor redColor];

label.layer.borderColor = [[UIColor grayColor]CGColor];

label.layer.borderWidth = 0.5f;

label.layer.masksToBounds = YES;

label.layer.cornerRadius = 5

#import< QuartzCore/QuartzCore.h>

你可能感兴趣的:(iOS的label如何既有边框又有背景色)