美文网首页
如何使用NSString在 drawInRect中居中

如何使用NSString在 drawInRect中居中

作者: 代码干货 | 来源:发表于2016-03-21 09:48 被阅读940次

<pre>NSMutableParagraphStyle* style = [[NSMutableParagraphStyle alloc] init];
[style setAlignment:UITextAlignmentCenter];
NSDictionary *attr = @{NSParagraphStyleAttributeName:style, NSFontAttributeName: [UIFont systemFontOfSize:10], NSForegroundColorAttributeName:[UIColor colorWithHexString:@"333333"]};
[rateStr drawInRect:frame withAttributes:attr];</pre>

参考链接

相关文章

网友评论

      本文标题:如何使用NSString在 drawInRect中居中

      本文链接:https://www.haomeiwen.com/subject/hmsklttx.html