Ios7 CGContextSetStrokeColorWithColor在iOS 7中失败

Ios7 CGContextSetStrokeColorWithColor在iOS 7中失败,ios7,core-graphics,cgcontext,Ios7,Core Graphics,Cgcontext,我使用此函数绘制自定义UILabel。它适用于iOS 6及更早版本,但在iOS 7中失败。如果我将CGContextSetStrokeColorWithColor替换为CGContextSetFillColorWithColor,它适用于iOS7,但不适用于6及更早版本 void ShadowedStrokedText(CGContextRef ctx,NSString *text,CGPoint textStartPont,UIColor *textColor,UIFont *font,CGF

我使用此函数绘制自定义UILabel。它适用于iOS 6及更早版本,但在iOS 7中失败。如果我将CGContextSetStrokeColorWithColor替换为CGContextSetFillColorWithColor,它适用于iOS7,但不适用于6及更早版本

void ShadowedStrokedText(CGContextRef ctx,NSString *text,CGPoint textStartPont,UIColor *textColor,UIFont *font,CGFloat lineWidth,UIColor * shadowColor,CGFloat shadowThickness){

CGContextSaveGState(ctx);

CGContextSetInterpolationQuality(ctx,kCGInterpolationHigh);
CGContextSetLineJoin(ctx, kCGLineJoinRound);

CGContextSetLineWidth(ctx, lineWidth);

CGContextSetStrokeColorWithColor(ctx, textColor.CGColor);
//---this works with iOS7 
//CGContextSetFillColorWithColor(ctx, textColor.CGColor);
CGContextSetTextDrawingMode(ctx, kCGTextStroke);
CGContextSetShadowWithColor(ctx,CGSizeMake(0,0),shadowThickness,[shadowColor CGColor]);

[text drawAtPoint:textStartPont withFont:font];

CGContextRestoreGState(ctx);}

为什么?

绘图点:with font:
您正在使用的是:


drawAtPoint:withFont:

使用指定字体在当前图形上下文中的指定点以单行形式绘制字符串(在iOS 7.0中不推荐使用。请改用drawAtPoint:withAttributes:


可能是他们从iOS 7I中删除的。没有反对,只有不同的行为。谢谢