大家好,下面的代码制作了一个带有深色边框的灰色小矩形。角落收音机不工作,我不知道为什么,我尝试应用 maskToBounds = true,但这只是隐藏了整个对象......
我怎样才能做到这一点?谢谢
CGRect r = CGRectMake(conX, conY, 220, 50);
UIBezierPath* conPath = [UIBezierPath bezierPathWithRect:r];
CAShapeLayer* conLayer = [CAShapeLayer layer];
conLayer.path = conPath.CGPath;
conLayer.cornerRadius = 5.0;
UIColor *bg = [UIColor colorWithWhite:1 alpha:0.7];
[conLayer setFillColor:bg.CGColor];
[conLayer setStrokeColor:[UIColor grayColor].CGColor];
[[self layer] addSublayer:conLayer];