我有以下代码,并在屏幕截图中显示错误。这个错误意味着什么
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if (textField.tag<10) {
if ((textField.text.length >= 1) && (string.length > 0))
{
NSInteger nextText = textField.tag + 1;
// Try to find next responder
UIResponder* nextResponder = [textField.superview viewWithTag:nextText];
if (! nextResponder)
[textField resignFirstResponder];
// nextResponder = [textField.superview viewWithTag:1];
if (nextResponder){
// Found next responder, so set it.
[nextResponder becomeFirstResponder];
UITextField* nextTextfield= (UITextField) [textField.superview viewWithTag:nextText];
[nextTextfield setText:string];
return NO;
}
}
}
return YES;
}
我在以下情况下遇到以下错误。我无法找到解决方案
答案 0 :(得分:1)
UITextField
应设置为指针(*
符号),如下所示:
UITextField* nextTextfield = (UITextField *) [textField.superview viewWithTag:nextText];