iOS给UILabel描边

来源:互联网 发布:控制系统仿真软件 编辑:程序博客网 时间:2024/05/17 20:31

- (void)drawTextInRect:(CGRect)rect {

   CGSize shadowOffset = self.shadowOffset;

   UIColor *textColor = self.textColor;

    

    CGContextRef c =UIGraphicsGetCurrentContext();

    CGContextSetLineWidth(c,2);

    CGContextSetLineJoin(c,kCGLineJoinRound);

    

    CGContextSetTextDrawingMode(c,kCGTextStroke);

   self.textColor = [UIColorwhiteColor];

    [superdrawTextInRect:rect];

    

    CGContextSetTextDrawingMode(c,kCGTextFill);

   self.textColor = textColor;

   self.shadowOffset =CGSizeMake(0,0);

    [superdrawTextInRect:rect];

    

   self.shadowOffset = shadowOffset;

}

0 0
原创粉丝点击