嗨,这是我的代码,我试图让 UI 文本视图键盘消失。我有 2 个文本字段,第二个是文本视图。我尝试拖动动作,但它不会让我。请帮忙!!!!!
- (IBAction)dismiss1:(id)sender{
[sender resignFirstResponder];
}
- (IBAction)dismiss2:(id)sender2{
[field2 resignFirstResponder];
}
嗨,这是我的代码,我试图让 UI 文本视图键盘消失。我有 2 个文本字段,第二个是文本视图。我尝试拖动动作,但它不会让我。请帮忙!!!!!
- (IBAction)dismiss1:(id)sender{
[sender resignFirstResponder];
}
- (IBAction)dismiss2:(id)sender2{
[field2 resignFirstResponder];
}
UITextView 没有事件操作。
Import <UITableViewDelegate, UITableViewDataSource> in header file and use below code to disapear keyboard when click on return button.
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
if ([text isEqualToString:@"\n"]) {
[self.textView resignFirstResponder];
// Return FALSE so that the final '\n' character doesn't get added
return NO;
}
// For any other character return TRUE so that the text gets added to the view
return YES;
}