处理UITextField,键盘消失问题
1. 通过UITextFiledDelegate,来释放第一响应者(resignFirstResponder);通过delegate释放键盘
-(BOOL)textFieldShouldReturn:(UITextFiled*)textField{
[textField resignFirstResponder];
return YES;
}
2.通过Done键的DidoneExit method,来resignFirstResponder;
3.点击编辑框的背景图片,让键盘消失。方法:将背景View 设为:UIControll。UIView本身不能相应事件,而UIcontroll 是可以相应事件的。UIControll继承于UIView;通过调用UIControll的Touch Down事件,让键盘消失
4.放置一个UIButton,将这个UIButton布满全屏,当点击非编辑区域时,其实就是点击这个巨型的Button。在这个button事件中,resignFirstResponder即可。
-(IBAction)backDissmissClick:(id)sender{
[textFiled resignFirstResponder];
}
补充:也可以在控件上添加手势,点击手势,在手机方法里面做操作