1、鍵盤風格 java
UIKit框架支持8種風格鍵盤。api
用法用例:緩存
textView.keyboardtype = UIKeyboardTypeNumberPad;安全
2、鍵盤外觀框架
用法用例:spa
textView.keyboardAppearance=UIKeyboardAppearanceDefault;.net
3、回車鍵blog
用法用例:get
textView.returnKeyType=UIReturnKeyGo;it
4、自動大寫
用法用例:
textField.autocapitalizationType = UITextAutocapitalizationTypeWords;
5、自動更正
用法用例:
textField.autocorrectionType = UITextAutocorrectionTypeYes;
6、安全文本輸入
textView.secureTextEntry=YES;
開啓安全輸入主要是用於密碼或一些私人數據的輸入,此時會禁用自動更正和自此緩存。
self._textField.returnKeyType=UIReturnKeyDone;
self._textField.delegate=self;
- (BOOL)textFieldShouldReturn:(UITextField *)textField{
[textField resignFirstResponder];
return YES;
}
self._textView.delegate=self;
self._textView.returnKeyType=UIReturnKeyDone;
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range
replacementText:(NSString *)text {
if ([text isEqualToString:@"\n"]) {
[textView resignFirstResponder];
return NO;
}
return YES;
}