I check my textfield like this:
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if ([subtitleField.text length] == 0)
{
searchAddress.hidden = NO;
}
else
{
searchAddress.hidden = YES;
}
return YES;
}
but it works only if I clear textfield by clear key, if I press clear button, it didn't work.
Implement the [UITextFieldDelegate textFieldShouldClear:]
method as well:
- (BOOL)textFieldShouldClear:(UITextField *)textField
{
searchAddress.hidden = NO;
return YES;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.