На самом деле существует другая форма установки свойства font \ font color.
if ([self.textField respondsToSelector:@selector(setAttributedPlaceholder:)]) {
self.textField.attributedPlaceholder = [[NSAttributedString alloc]
initWithString:placeholder
attributes:@{
NSForegroundColorAttributeName: newColor,
NSFontAttributeName:font,
NSBaselineOffsetAttributeName:[NSNumber numberWithFloat:offset]
}];
} else {
NSLog(@"Cannot set placeholder text's color, because deployment target is earlier than iOS 6.0");
// TODO: Add fall-back code to set placeholder color.
}
Обратите внимание на NSBaselineOffsetAttributeName
, и это решит проблему неправильного вертикального выравнивания.