unsigned int count = 0;
Ivar *ivars = class_copyIvarList([UITextField class], &count);
for (int i = 0; i < count; i++) {
Ivar ivar = *(ivars + i);
Ivar ivar = ivars[i];
NSLog(@"%s",ivar_getName(ivar));
[self setValue:[UIColor whiteColor] forKeyPath:@"placeholderLabel.textColor"];
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
dict[NSForegroundColorAttributeName] = [UIColor whiteColor];
NSAttributedString *str = [[NSAttributedString alloc] initWithString:self.placeholder attributes:dict];
self.attributedPlaceholder = str;
- 重写drawPlaceholderInRect方法
-(void)drawPlaceholderInRect:(CGRect)rect
{
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
dict[NSForegroundColorAttributeName] = [UIColor whiteColor];
CGRect newRect = CGRectMake(0, rect.size.height * 0.3, rect.size.width, rect.size.height);
[self.placeholder drawInRect:newRect withAttributes:dict];
}