我有一些 UItextView IBOutlet,我需要在其中设置属性字符串。在代码中我有:
NSArray *textViews = @[self.addressTextView, self.webpageTextView, self.phoneTextView, self.phone2TextView, self.emailTextView, self.emailPkTextVIew, self.akkrTextView, self.licenseTxt];
...
for (NSInteger i = 0; i < textViews.count; i++) {
UITextView *txtView = textViews[i];
... //making attributed string
NSMutableAttributedString *fullString;
...
[fullString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Helvetica" size:15.0] range:(NSRange){0,fullString.length}];
NSLog(@"\n%@", fullString);
txtView.attributedText = fullString;
NSLog(@"\n%@ %@", txtView.attributedText);
}
所以在第一个日志中我看到字体大小是 15,但在第二种情况下有时一切都很好(对于文本视图),但有时字体大小变成 22 或 25。为什么?