我正在使用通知中心来获取有关 uitextfield 完成编辑的通知,这是我的代码...
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(textFieldChange:) name:UITextFieldTextDidEndEditingNotification object:nil];
和我的功能...
-(void)textFieldChange:(id)sender{
UITextField *my=(UITextField *)sender; // NOT WORKING
if([my.text length]==0){
UIAlertView *myAlert=[[UIAlertView alloc]initWithTitle:@"Please Fill This" message:@"This Field Can Not be Kept Empty!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil, nil];
[myAlert show];
}
}
这有什么问题?,我觉得发件人没有在文本字段中输入类型!