设置占位符颜色
// 设置了占位文字内容以后, 才能设置占位文字的颜色
[textField setValue:[UIColor grayColor] forKeyPath:@"_placeholderLabel.textColor"];
设置消息中心,监听值的改变
//监听textFiel的值时时改变
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(textFieldDidChangeValue:)
name:UITextFieldTextDidChangeNotification
object:self.bodyValueTextField];
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
网友评论