goo*_*guy 11
嗨,如果你想回答,用键盘上的默认"完成"按钮重新启动UITextview的键盘,那么这就是答案
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range
replacementText:(NSString *)text {
// Any new character added is passed in as the "text" parameter
if([text isEqualToString:@"\n"]) {
// Be sure to test for equality using the "isEqualToString" message
[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;
}
Run Code Online (Sandbox Code Playgroud)
如果有任何疑虑通知我,我按照这个来取消UITextview的键盘
谢谢
创建IBAction并在IB把它挂到UITextfield的DidEndOnExit事件.然后打电话[textViewName resignFirstResponder]让键盘消失.
或者,尝试[self.view endEditing:YES]在IBAction中使用.
| 归档时间: |
|
| 查看次数: |
15327 次 |
| 最近记录: |