由于某种原因,当我在iPad上运行我的应用时,点击UITextFields
以填充数据会导致整个应用冻结几秒钟。我正在浏览Stack,and a similar question answered说这可能是因为我在后台线程上运行textFieldShouldEndEditing
?但我在一个主要线程上运行我的:
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
});
return YES;
}
知道可能导致冻结的原因吗?