I'm using attributed strings in my iOS app to give the text some style:
NSDictionary *titleAttributes = @{NSFontAttributeName: [UIFont fontWithName:@"Raleway" size:12],
NSForegroundColorAttributeName: [UIColor lightGreyTextColor]};
NSMutableAttributedString *attributedTitle = [[NSMutableAttributedString alloc] initWithString:title attributes:titleAttributes];
The problem is that on iOS 6, the text is not vertically centered in the UILabel
anymore. On iOS 7 it's fine.
I found that when I remove the NSForegroundColorAttributeName
attribute then it's correctly centered but the text is black
Does anyone know a way to fix that? Is it a bug in iOS or am I missing something?
Try to use UITextAttributeTextColor
instead of NSForegroundColorAttributeName
.
Seems to be the same issue, as in this question.