1 .实现
UITextFieldDelegate协议
.m文件里面实现
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
if(![self.textfild
isExclusiveTouch]){
[self.textfild
resignFirstResponder];
}
}
方法,放弃第一响应者的身份,点击空白处即可推出软键盘
2.监听软键盘的return键,点击return可以返回
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
[self.textfild
resignFirstResponder];
return
YES;
}
时间: 2024-10-19 22:50:30