1)实现代理方法
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if (textField == self.nameTextField) {
if (range.location > 14) {
return NO;
}
}
if (textField == self.cardTextField) {
if (range.location > 17) {
return NO;
}
}
return YES;
}
网友评论