1、使用UITextView或UITextField时,修改键盘的return
textView.returnKeyType = UIReturnKeyDone;
UIReturnKeyDefault,
UIReturnKeyGo,
UIReturnKeyGoogle,
UIReturnKeyJoin,
UIReturnKeyNext,
UIReturnKeyRoute,
UIReturnKeySearch,
UIReturnKeySend,
UIReturnKeyYahoo,
UIReturnKeyDone,
UIReturnKeyEmergencyCall,
2、修改键盘样式
textView.keyboardType = UIKeyboardTypeNumberPad;
UIKeyboardTypeDefault,
UIKeyboardTypeASCIICapable,
UIKeyboardTypeNumbersAndPunctuation,
UIKeyboardTypeURL,
UIKeyboardTypeNumberPad,
UIKeyboardTypePhonePad,
UIKeyboardTypeNamePhonePad,
UIKeyboardTypeEmailAddress,
3、键盘消失
//能调用到textView或UITextField时,直接移除响应
[textView resignFirstResponder];
//调用不到时,所在view设置成不可编辑状态
[self.view endEditing:NO];
网友评论