标签:
1.监听UITextField输入 - (void)viewDidLoad { [super viewDidLoad]; //监听文本输入框的改变 //1.拿到通知中心 NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; //2.注册监听:注意一定要写上通知的发布者 [center addObserver:self selector:@selector(beginEditing) name:UITextFieldTextDidBeginEditingNotification object:self.textField]; [center addObserver:self selector:@selector(textChange) name:UITextFieldTextDidChangeNotification object:self.textField]; [center addObserver:self selector:@selector(endEditing) name:UITextFieldTextDidEndEditingNotification object:self.textField]; } -(void)beginEditing { NSLog(@"beginEditing"); } -(void)textChange { NSLog(@"editing....."); } -(void)endEditing { NSLog(@"endEditing"); }
标签:
原文地址:http://www.cnblogs.com/jsnan/p/4314941.html