刚刚Q群里面有位美女发了她的UILabel的文字特效的效果,很受赞~我在这里就借花献佛了,哈……(借美女的成功记录在我的博客里)
 
先看看特效先吧,
uilabel文字特效制作_第1张图片
 
这种特效其实也挺简单的, 就是啊
uilabel
中重写
- (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 = [UIColor whiteColor];
         [super drawTextInRect:rect];
         
         CGContextSetTextDrawingMode(c, kCGTextFill);
         self.textColor = textColor;
         self.shadowOffset = CGSizeMake(0, 0);
         [super drawTextInRect:rect];
         
         self.shadowOffset = shadowOffset;
 
 
    ......


}