// // UILabelOutLined.m // XWorld // // Created by XM on 16/9/2. // Copyright © 2016年 xiongmaitech. All rights reserved. // #import "UILabelOutLined.h" @implementation UILabelOutLined -(id)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if (self) { self.font = [UIFont systemFontOfSize:14]; self.textColor = [UIColor whiteColor]; self.alpha = 0.7; } return self; } - (void)drawTextInRect:(CGRect)rect { CGSize shadowOffset = self.shadowOffset; UIColor *textColor = self.textColor; CGContextRef c = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(c, 1); CGContextSetLineJoin(c, kCGLineJoinRound); CGContextSetTextDrawingMode(c, kCGTextStroke); self.textColor = [UIColor darkGrayColor]; [super drawTextInRect:rect]; CGContextSetTextDrawingMode(c, kCGTextFill); self.textColor = textColor; self.shadowOffset = CGSizeMake(0, 0); [super drawTextInRect:rect]; self.shadowOffset = shadowOffset; } @end