setAutocorrectionType:它默認(rèn)就是yes堪伍,可以禁掉(即設(shè)為NO)。
不僅SearchBar、TextField辆毡、UITextView,都可用到此Method.
[searchBar setAutocorrectionType:UITextAutocorrectionTypeNo];
[textField setAutocorrectionType:UITextAutocorrectionTypeNo];
[textView setAutocorrectionType:UITextAutocorrectionTypeNo];
@property(nonatomic) UITextAutocorrectionType autocorrectionType; // default is UITextAutocorrectionTypeDefault
typedef NS_ENUM(NSInteger, UITextAutocorrectionType) {
UITextAutocorrectionTypeDefault,
UITextAutocorrectionTypeNo,
UITextAutocorrectionTypeYes,
};
autocorrectionType效果圖.jpg