先看一下效果图:
官方文档:
// The textContentType property is to provide the keyboard with extra information about the semantic intent of the text document.
@property(null_unspecified,nonatomic,copy) UITextContentType textContentType API_AVAILABLE(ios(10.0)); // default is nil
直接上代码:
if (@available(iOS 10.0, *)) {
//Xcode 10 适配
self.codeField.textContentType = UITextContentTypeOneTimeCode;
}
xib设置: