Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios5 无法在iOS 5中键入UITextfield?_Ios5 - Fatal编程技术网

Ios5 无法在iOS 5中键入UITextfield?

Ios5 无法在iOS 5中键入UITextfield?,ios5,Ios5,我正在使用成为textfield的第一响应者。如果我尝试点击BecomeFirstResponder文本字段。光标移动到该文本字段,但我无法键入该文本字段。此问题仅在iOS 5中出现,但在iOS 4中效果良好。请解释我如何解决这个问题 if (textField == fnameTxtFld){ if([fnameTxtFld.text length]>0) { if ([fnameTxtFld.text length]<

我正在使用成为textfield的第一响应者。如果我尝试点击BecomeFirstResponder文本字段。光标移动到该文本字段,但我无法键入该文本字段。此问题仅在iOS 5中出现,但在iOS 4中效果良好。请解释我如何解决这个问题

  if (textField == fnameTxtFld){

        if([fnameTxtFld.text length]>0)
        {
            if ([fnameTxtFld.text length]<= 100) {

                if (![self checkForSpecialChar:fnameTxtFld.text]) {

                    Custom_Alert *alert=[[Custom_Alert alloc]initWithTitle:@"Alert" message:@"Please check the details entered in First Name" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];

                    [alert show];
                    [alert release];

                    [fnameTxtFld becomeFirstResponder];

                    return NO;

                }
                else
                {
                    [textField resignFirstResponder];
                    fnameTxtImg.image=[UIImage imageNamed:@"birth_date.png"];
                    //    [lnameTxtFld performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.0];
                    [lnameTxtFld becomeFirstResponder];

                    return YES;
                }
            }        
            else {
                Custom_Alert *alert=[[Custom_Alert alloc]initWithTitle:@"Alert" message:@"Please check the details entered in First Name" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
                [alert show];
                [alert release];

                [fnameTxtFld becomeFirstResponder];

                return NO;

            }

        }
        else {
            [lnameTxtFld becomeFirstResponder];

            return YES;
            // [fnameTxtFld resignFirstResponder];
        }
    }
if(textField==fnameTxtFld){
如果([fnameTxtFld.text length]>0)
{

如果([fnameTxtFld.text length]我认为这个问题在xcode 4.2中,如果我们在同一个循环中使用退出FirstResponder并成为FirstResponder,我们将面临这种问题,要解决这个问题,您可以遵循下面的代码。这可能会对您有所帮助

辞职第一响应者

[[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];
[textfield performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.0];
成为第一反应者

[[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];
[textfield performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.0];

我认为这个问题出现在xcode 4.2中,如果我们使用辞职FirstResponder并成为同一循环中的FirstResponder,我们将面临这种问题,要解决这个问题,您可以遵循下面的代码。这可能会对您有所帮助

辞职第一响应者

[[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];
[textfield performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.0];
成为第一反应者

[[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];
[textfield performSelector:@selector(becomeFirstResponder) withObject:nil afterDelay:0.0];

我认为这只会部分起作用。我通过在“应该开始编辑”中设置布尔变量,解决了这个问题。我将在didend编辑中访问这个变量。
调用DiEndediting时不应调用“应开始”。感谢您的响应。

我认为这只能部分起作用。通过在“应开始编辑”中设置布尔变量,我解决了此问题。我将在DiEnd编辑中访问此变量。 当调用DiEndediting时,不应调用“应开始”。感谢您的回复