iOS 7中的iOS Stroke文本

时间:2014-02-15 18:45:02

标签: ios uilabel stroke

我正试图在iOS 7.1中的UILabel中描边文本。我无法弄清楚为什么它不起作用...任何帮助将不胜感激。

 NSMutableDictionary *stringAttributes = [NSMutableDictionary dictionary];

[stringAttributes setObject: [UIFont fontWithName:@"Helvetica" size:20] forKey: NSFontAttributeName];
[stringAttributes setObject: [UIColor whiteColor] forKey: NSForegroundColorAttributeName];
[stringAttributes setObject: [NSNumber numberWithFloat: 2.0] forKey: NSStrokeWidthAttributeName];
[stringAttributes setObject: [UIColor blackColor] forKey: NSStrokeColorAttributeName];

[label.text drawInRect:CGRectMake(0, 0, 200, 50) withAttributes:stringAttributes];

0 个答案:

没有答案