Pergunta

eu usei inputView mostrar uipickerview para o meu textfield, mas eu uso o mesmo textfield para outras funções.Como posso mostrar o teclado padrão depois de usar inputView por isso textfield?

textfield.inputView = pickrView;
Foi útil?

Solução

Apenas

textfield.inputView = nil;

funcionou para mim

Outras dicas

Como disse Pavel Kaljunen, você só precisa definir o inputView como nulo, mas quando o teclado já estiver visível, você deve primeiro renunciar ao FirstResponder, definir o inputView como nulo e depois se tornar o FirstResponder novamente.

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.35];

[yourTextField resignFirstResponder];
yourTextField.inputView = nil;
[yourTextField becomeFirstResponder];

[UIView commitAnimations];

acho que esse código talvez possa funcionar

 [textField.inputView addTarget:self action:@selector(doTest) forControlEvents:UIControlEventTouchUpInside];

- (void)doTest
{
  if([textFiled isFirstResponder])
  {
    [textFiled resignFirstResponder];
  }
  else
  {
    [textFiled becomeFirstResponder];
  }
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top