Iphone 辞去numberpad的第一响应者

Iphone 辞去numberpad的第一响应者,iphone,Iphone,在我的登录表单中有一个输入PIN的文本字段。当我按下“登录”按钮时,我调用以下方法: * (IBAction) loginBeforeAction:(id) sender { [pin resignFirstResponder]; [progressView performSelectorInBackground:@selector(startAnimating) withObject:nil]; [self login]; } 但我知道,在控件移动

在我的登录表单中有一个输入PIN的文本字段。当我按下“登录”按钮时,我调用以下方法:

* (IBAction) loginBeforeAction:(id) sender { 
      [pin resignFirstResponder]; 
      [progressView performSelectorInBackground:@selector(startAnimating) withObject:nil]; 
      [self login]; 
}

但我知道,在控件移动到登录方法之前,数字键盘没有隐藏。实际上,我可以看到带有数字垫的进度视图。有没有办法先隐藏数字键盘,然后显示进度视图?plz help

是的,只有通过运行循环,用户界面才会更新。也就是说,在登录方法完成之前,用户界面不会更新。此外,也不需要在后台更新progressView

因此,只需延迟通话:

[progressView performSelector:@selector(startAnimating) withObject:nil afterDelay:0.1];
[self performSelector:@selector(login) withObject:nil afterDelay:0.25];