0

我有一个NSOperation做一些繁重计算的子类。它也有一个代表。

如果用户没有提供正确的输入,我会在main方法中验证它,并通过performSelectorOnMainThread我创建并显示一个警报(来自我的NSOperation子类),然后我这样调用委托方法:

    -(void) main{
    [self performSelectorOnMainThread:@selector(showAnAlert)
                                       withObject:nil
                                    waitUntilDone:YES];
                [self cancel]; //I need to cancel the operation
                return; //don't want to finish main running.

    }

- (void) showAnAlert{
   //Create an alert here
   [alert show];
}

And in my VC I have this: 

- (void) aDelegateMethodFromMyOperation{
   [self.textField setEndEditing:YES];
}

现在的问题是,一旦我解除警报,我就无法在我的 textField 中输入任何文本......它会在点击时显示键盘......但它不会接受我的输入......这是为什么?

4

1 回答 1

1

也许尝试:

[textField becomeFirstResponder];

由于您在 中切换多个 UI 元素NSOperation,因此文本字段可能无法重新获得完全控制。

于 2013-04-23T00:34:42.260 回答