、、、
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if ([FunctionClass IsBlankString:string])
{
return YES;
}
char commitChar = [string characterAtIndex:0];
if (commitChar > 96 && commitChar < 123)
{
//小写变成大写
NSString * uppercaseString = string.uppercaseString;
NSString * str1 = [textField.text substringToIndex:range.location];
NSString * str2 = [textField.text substringFromIndex:range.location];
textField.text = [NSString stringWithFormat:@"%@%@%@",str1,uppercaseString,str2];
return NO;
}
return YES;
}
、、、
网友评论
为空的话直接 return