2

我正在使用带有此 drawRect 方法的自定义 UILabel 类:

- (void)drawTextInRect:(CGRect)rect
{
CGContextRef c = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(c, self.outlineSize);

CGContextSetTextDrawingMode(c, kCGTextStroke);
self.textColor = strokeColor;
[super drawTextInRect:rect];

CGContextSetTextDrawingMode(c, kCGTextFill);
self.textColor = fillColor;
self.shadowOffset = CGSizeMake(0, 0);
[super drawTextInRect:rect];
}

但是我有一个问题,当我通过pickerview更改strokeColor(myText.strokeColor = [self colorWithHex:0xe55f00])时,它可以正常工作,因为它会改变标签笔划的颜色。
相反,当我编辑 fillColor 时,它会同时改变填充和描边的颜色!(myText.fillColor = [self colorWithHex:0x000000])

我究竟做错了什么??

4

0 回答 0