如何使用NSString在 drawInRect中居中

2016-03-21  本文已影响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>

参考链接

上一篇 下一篇

猜你喜欢

热点阅读