3
我是新來的iPad編程,我想知道如何關閉在UItablecell中定義的UItextview中的鍵盤。我在單元格中定義了多個textview。請幫助我,並從你身邊得到適當的解決方案或建議。如何從UITableview中定義的UITextview中關閉鍵盤IPad
我是新來的iPad編程,我想知道如何關閉在UItablecell中定義的UItextview中的鍵盤。我在單元格中定義了多個textview。請幫助我,並從你身邊得到適當的解決方案或建議。如何從UITableview中定義的UITextview中關閉鍵盤IPad
發送文本查看消息resignFirstResponder
並且鍵盤將消失。如果您需要解除對返回鍵的響應,請考慮讓您的視圖控制器採用UITextViewDelegate
協議。
[self.textViewInQuestion resignFirstResponder];
或者,你可以發送endEditing:
消息給表視圖這樣的:
/*
Attempt to resign first responder status on any textfields within
the view's hierarchy.
*/
[self.tableView endEditing:NO];
// OR we can....
/*
Force text fields within the view's hierarchy to resign first responder.
Textfield delegates cannot prevent this from happening so this is not
recommended if you need to perform field validation and prevent the user
from leaving the textfield.
However sometimes it is useful to be able to force the resignation of the
first responder status even with validation so it goes both ways really.
*/
[self.tableView endEditing:YES];