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

你可能感兴趣的:(iOS UITextField 禁止第三方输入法)