总结一下关于iOS系统键盘的样式设置
键盘样式
_textField.keyboardType=UIKeyboardTypeNumberPad;
// UIKeyboardTypeNamePhonePad;//字母键盘可切换纯数字键盘
// UIKeyboardTypeDecimalPad;//数字键盘带小数点
// UIKeyboardTypePhonePad;//数字键盘带+ * -
UIKeyboardTypeDefault, // 支持ASCII的默认键盘
UIKeyboardTypeNumbersAndPunctuation, // 标准电话键盘,支持+*#等符号
UIKeyboardTypeURL, // URL键盘,有.com按钮;只支持URL字符
UIKeyboardTypeNumberPad, // 纯数字键盘
UIKeyboardTypePhonePad, // 电话键盘
UIKeyboardTypeNamePhonePad, // 电话键盘,也支持输入人名字
UIKeyboardTypeEmailAddress, // 用于输入电子邮件地址的键盘
键盘返回按钮
_textField.returnKeyType=UIReturnKeyDone;//return键是Done
// UIReturnKeyDefault,换行
// UIReturnKeyGo,前往
// UIReturnKeyGoogle,搜索
// UIReturnKeyJoin,加入
// UIReturnKeyNext,下一项
// UIReturnKeyRoute,路线
// UIReturnKeySearch,搜索
// UIReturnKeySend,发送
// UIReturnKeyYahoo,搜索
// UIReturnKeyDone,完成
// UIReturnKeyEmergencyCall,紧急电话
隐藏系统键盘的方法
.h中设置 <UITextFieldDelegate>
@property(nonatomic,retain)UITextField *txtF;
- (void)viewDidLoad
{
[superviewDidLoad];
// 给self.view添加手势 回收系统键盘
UIGestureRecognizer *hideKeyBoardGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(hideKeyBoard)];
self.view.userInteractionEnabled = YES;
[self.view addGestureRecognizer:hideKeyBoardGesture];
[hideKeyBoardGesture release];
self.txtF = [[UITextField alloc]initWithFrame:CGRectMake(0,100,320,100)];
[_txtF setBorderStyle:UITextBorderStyleRoundedRect];
[_txtF setDelegate:self];
}
-(void)hideKeyBoard
{
NSLog(@"回收系统键盘");
[_txtF resignFirstResponder];
}