嗨,我正在开发 UITextview
如何退出键盘,在键盘“完成按钮”后单击操作,即 XIB
谢谢
最佳答案
嗨,如果您想回答,使用键盘上默认的“完成”按钮退出 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;
}
我按照这个放弃了UITextview的键盘,如果有任何问题请告诉我
谢谢
关于iPhone:通过 XIB 完成按钮操作来放弃键盘,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4750606/