1.打開鍵盤,當打開某個View,希望打開鍵盤的時候,在ViewDidLoad的方法中插入如下代碼
[myTextField becomeFirstResponder];
2.當需要關閉鍵盤的時候,在關鍵鍵盤的事件中,如button 寫下如下的代碼
[myTextField resignFirstResponder];
輕觸背景隐藏軟鍵盤
(IBAction)View_TouchDown:(id)sender {
// 發送resignFirstResponder.