我遇到了一个问题,即离开aUITextField
或. 此外,我创建了一个大按钮作为视图的背景,因此如果用户在字段之外点击它就会被触发。我在常规视图控制器中使用相同的代码,它按预期工作。在模态视图控制器中它什么也不做。任何建议,将不胜感激。UITextView
UIModalPresentationFormSheet
- (BOOL)textFieldShouldReturn:(id)sender {
[titleTextField resignFirstResponder];
return YES;
}
- (BOOL)textViewShouldReturn:(id)sender {
[synopsisTextView resignFirstResponder];
return YES;
}
- (IBAction)textFieldDoneEditing:(id)sender {
[sender resignFirstResponder];
}
- (IBAction)textViewDoneEditing:(id)sender {
[sender resignFirstResponder];
}
- (IBAction)backgroundClick:(id)sender {
[titleTextField resignFirstResponder];
[synopsisTextView resignFirstResponder];
}