Comment afficher le clavier après avoir utilisé inputView
-
12-12-2019 - |
Question
j'ai utilisé inputView
montrer uipickerview
pour mon textfield
, mais j'utilise la même chose textfield
pour d'autres fonctions.Comment puis-je afficher le clavier standard après avoir utilisé inputView
pour ça textfield
?
textfield.inputView = pickrView;
La solution
Juste
textfield.inputView = nil;
a fonctionné pour moi
Autres conseils
Comme l'a dit Pavel Kaljunen, il vous suffit de définir inputView sur nil, mais lorsque le clavier est déjà visible, vous devez d'abord démissionner de FirstResponder, définir inputView sur nil, puis redevenir FirstResponder.
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.35];
[yourTextField resignFirstResponder];
yourTextField.inputView = nil;
[yourTextField becomeFirstResponder];
[UIView commitAnimations];
je pense que ce code peut peut-être fonctionner
[textField.inputView addTarget:self action:@selector(doTest) forControlEvents:UIControlEventTouchUpInside];
- (void)doTest
{
if([textFiled isFirstResponder])
{
[textFiled resignFirstResponder];
}
else
{
[textFiled becomeFirstResponder];
}
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow