UITextfield修改placehoder颜色
@interface MyTextfield : UITextField
@end
#import "MyTextfield.h"
@implementation MyTextfield
-(void)drawPlaceholderInRect:(CGRect)rect {
CGSize placeholderSize = [self.placeholder sizeWithAttributes:@{NSFontAttributeName : self.font}];
[self.placeholder drawInRect:CGRectMake(0, (rect.size.height - placeholderSize.height)/2, rect.size.width, rect.size.height)
withAttributes:@{
NSForegroundColorAttributeName: [UIColor redColor],
NSFontAttributeName : self.font}];
}
@end