- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range
replacementString:(NSString *)string
{
//Check that response should be a maximum 5 characters
if ([string length] > 0) {
return [textField.text length] < 5;
}
return YES;
}
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if([string length]>0{
return [textField.text length]<5; //这里报错,textField没有 text属性?
}
return YES;
}
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/tech/aiops/3346.html