利用运行时设置UITextField 光标颜色
#import "XMGLoginRegisterTextField.h"
#import <objc/runtime.h>
@implementation XMGLoginRegisterTextField
- (void)awakeFromNib
{
//设置光标颜色
self.tintColor = [UIColor whiteColor];
//默认行为
[self resignFirstResponder];
}
/**
*正在编辑
*/
- (BOOL)becomeFirstResponder
{
[self setValue:[UIColor whiteColor] forKeyPath:XMGTextFieldPlaceholderColor];
return [super becomeFirstResponder];
}
/**
*结束编辑
*/
- (BOOL)resignFirstResponder
{
[self setValue:[UIColor grayColor] forKeyPath:XMGTextFieldPlaceholderColor];
return [super resignFirstResponder];
}
@end
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。