iOS UITextField 禁止第三方输入法

UITextField 无法显示第三方输入法情况,同时有2个UITextField,取名为:账号和密码,
密码secureTextEntry = YES; 密码frame必须在账号下方,同时不能hidden = YES;高度必须大于1,可以enabled = NO;这样账号就可以禁止第三方输入法了,但是会显示密码填充对话框
据说是iOS10 才有这个功能

UITextField *nameTF = [[UITextField alloc]init];
nameTF.backgroundColor = UIColor.orangeColor;
[self.containerView addSubview:nameTF];
        [nameTF mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.bottomAttribute).mas_offset(20);
            make.left.mas_equalTo(10);
            make.right.mas_equalTo(-10);
            make.height.mas_equalTo(50);
        }];

  UITextField *pswTF = [[UITextField alloc]init];
        pswTF.backgroundColor = UIColor.clearColor;
        pswTF.secureTextEntry = YES;
        pswTF.enabled = NO;
        [self.containerView addSubview:pswTF];
        [pswTF mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.bottomAttribute).mas_equalTo(10);
            make.left.mas_equalTo(10);
            make.right.mas_equalTo(-10);
            make.height.mas_equalTo(1.0);
        }];

图片.png

图片.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容