I have used the below code to display a colored placeholder within iOS Textfield. This works fine in iOS 5 and 6. But in iOS 7 a line appears in the middle of the Textfield.
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
}
- (void) drawPlaceholderInRect:(CGRect)rect {
[SEARCH_FIELD_FONT_COLOR setFill];
if (self.placeholderFont) {
[[self placeholder] drawInRect:rect withFont:SEARCH_FIELD_FONT];
}else {
[[self placeholder] drawInRect:rect withFont:self.placeholderFont];
}
}
@end