- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
NSInteger tag = textField.tag;
if(tag ==10 || tag ==11 || tag ==12){
if(keyboardVisible){//判断键盘是否显示
[textField resignFirstResponder];
}
[self moveTo:pickView andX:0 andY:HIGHT-230 andTime:0.3];
return NO;
}else{
return YES;
}
}
当键盘显示时,用[textField resignFirstResponder]
为什么不能隐藏键盘?
执行了这句代码,但是键盘不能隐藏......
if(keyboardVisible){//判断键盘是否显示
[textField resignFirstResponder];
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
已解决: [self.view endEditing:YES];
代理加了没
声明textfiled
如果你没有进行上述操作,请尝试以下,看是否可以了
我没看懂你问的问题,点击textfield是编辑状态。隐藏键盘?
试试[textField endEditing:YES];