圖一
這是因為系統(tǒng)默認(rèn)啟動了自動糾錯功能嫡良,關(guān)閉就可以了锰扶。
//不自動糾錯
self.pswTf.autocorrectionType = UITextAutocorrectionTypeNo;
//關(guān)閉首字母大寫
self.pswTf.autocapitalizationType = UITextAutocapitalizationTypeNone;
順便也標(biāo)明一下UITextField的鍵盤類型,方便以后查看寝受。
typedef enum {
UIKeyboardTypeDefault, 默認(rèn)鍵盤:支持所有字符
UIKeyboardTypeASCIICapable, 支持ASCII的默認(rèn)鍵盤
UIKeyboardTypeNumbersAndPunctuation, 標(biāo)準(zhǔn)電話鍵盤:支持+*#字符
UIKeyboardTypeURL, URL鍵盤:支持.com按鈕,只支持URL字符
UIKeyboardTypeNumberPad, 數(shù)字鍵盤
UIKeyboardTypePhonePad, 電話鍵盤
UIKeyboardTypeNamePhonePad, 電話鍵盤:也支持輸入人名
UIKeyboardTypeEmailAddress, 用于輸入電子郵件地址的鍵盤
UIKeyboardTypeDecimalPad, 數(shù)字鍵盤:數(shù)字和小數(shù)點
UIKeyboardTypeTwitter, 優(yōu)化的鍵盤颜及,方便輸入@痊土、#字符
UIKeyboardTypeAlphabet = UIKeyboardTypeASCIICapable,
} UIKeyboardType;