//
// HQTextField.m
// FunnySister
//
// Created by hq on 16/4/27.
// Copyright © 2016年 hanqing. All rights reserved.
//
#import "HQTextField.h"
#import <objc/runtime.h>
@implementation HQTextField
//通过运行时获取我们TextField当中的一些隐含属性
-(void)awakeFromNib{
// unsigned int count=0;
//
// //获取所有的属性
// Ivar *ivars=class_copyIvarList([UITextField class], &count);
//
// for (int i=0; i<count; i++) {
//
// Ivar ivar=ivars[i];
//
// NSString *attrName=@(ivar_getName(ivar));
//
// HQLog(@"%@",attrName);
//
// }
// free(ivars);
UILabel *label=[self valueForKey:@"_placeholderLabel"];
label.textColor=[UIColor grayColor];
//设置光标的颜色
self.tintColor=[UIColor grayColor];
}
-(BOOL)becomeFirstResponder{
UILabel *label=[self valueForKey:@"_placeholderLabel"];
label.textColor=self.textColor;
return [super becomeFirstResponder];
}
-(BOOL)resignFirstResponder{
UILabel *label=[self valueForKey:@"_placeholderLabel"];
label.textColor=[UIColor grayColor];
return [super resignFirstResponder];
}
@end