Pergunta

Eu verifico o meu textfield como este:

-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
    if ([subtitleField.text length] == 0)
    {
        searchAddress.hidden = NO;
    }
    else 
    {
        searchAddress.hidden = YES;
    }

   return  YES;   
}

mas ele só funciona se eu limpar textfield pela tecla limpar, se eu pressione o botão limpar, não funcionou.

Foi útil?

Solução

Implementar o [UITextFieldDelegate textFieldShouldClear:] método:

- (BOOL)textFieldShouldClear:(UITextField *)textField
{
    searchAddress.hidden = NO;
    return YES;
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top