不应在ios7-64位的范围内更改字符
我使用此方法替换和检查uitextfield中的实时输入,但这在ios 7-64位上不起作用不应在ios7-64位的范围内更改字符,ios,objective-c,ios7,64-bit,Ios,Objective C,Ios7,64 Bit,我使用此方法替换和检查uitextfield中的实时输入,但这在ios 7-64位上不起作用 - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { if (textField == textInput) { NSString * text = [textField.text
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if (textField == textInput) {
NSString * text = [textField.text stringByReplacingCharactersInRange:range withString:string];
text = [text stringByReplacingOccurrencesOfString:@"*" withString:@"?"];
[textField setText:text];
return NO;
}
return YES;
}
我检查这个文本字段并只输入数字,但在ios7-64位中,它最多只输入4个数字
有什么解决方案吗?
应该更改字符范围
这应该和IOS7一样工作。未更改UITextField
的代理
检查以下内容:
确保将委托设置为UITextField
self.textInput.delegate = self;
如果(textField==textInput)
这段代码对我来说很好用
如何在ios7-64位(设备:iphone5s)中声明此textInputBut。这项工作不正确。当我输入数字时,最大值为4,但我希望输入更多
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
NSString * text = [textField.text stringByReplacingCharactersInRange:range withString:string];
text = [text stringByReplacingOccurrencesOfString:@"*" withString:@"?"];
[textField setText:text];
return NO;
}