更改占位符颜色

时间:2015-07-14 09:35:49

标签: objective-c ios7 uitextfield

我使用此代码更改了占位符颜色,但它无效。

我在类别中使用了这种方法。

 -(void) drawPlaceholderInRect:(CGRect)rect {
    [[UIColor blueColor] setFill];
    [[self placeholder] drawInRect:rect withFont:[UIFont systemFontOfSize:16]];
}
error:
Category is implementing a method which will also be implemented by its :

'drawInRect:withFont:'不推荐使用:首先在iOS 7.0中弃用 - 使用-drawInRect:withAttributes:

1 个答案:

答案 0 :(得分:0)

尝试:

[AnotherDimension].[AnotherHierarchy].

而不是' drawInRect:withFont:'

*属性是一个带有你想要的属性的NSDictionary,你可以在那里指定你想要的字体,以及其他东西,比如颜色等。