iOS巔峯之label描邊

- (void)drawTextInRect:(CGRect)rect

{ CGSize shadowOffset = self.shadowOffset

UIColor *textColor = self.textColor;  

CGContextRef c = UIGraphicsGetCurrentContext();  

CGContextSetLineWidth(c, self.outlineWidth); 

CGContextSetLineJoin(c, kCGLineJoinRound);  

CGContextSetTextDrawingMode(c, kCGTextStroke);  

self.textColor = self.outlineColor;  

[super drawTextInRect:rect];  

CGContextSetTextDrawingMode(c, kCGTextFill); 

self.textColor = textColor;  

self.shadowOffset = CGSizeMake(0, 0);  

[super drawTextInRect:rect];  

self.shadowOffset = shadowOffset;

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章