Ocultar una contraseña de UITextField


Estoy haciendo una página de inicio de sesión. Tengo UITextField para la contraseña.

Obviamente, no quiero que se vea la contraseña; en su lugar, quiero que se muestren círculos al escribir. ¿Cómo se establece el campo para que esto suceda?

Author: iPrabu, 2011-07-05

9 answers

Por favor, establezca su propiedad UITextField segura..

Prueba esto..

textFieldSecure.secureTextEntry = YES;

TextFieldSecure es tu UITextField...

 293
Author: Mehul Mistri,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-07-05 06:51:59

Uno puede hacer esto para Ocultar una contraseña UITextField:

introduzca la descripción de la imagen aquí

CÓDIGO

Objetivo-C:

  textField.secureTextEntry = YES;

Swift:

  textField.isSecureTextEntry = true 
 76
Author: Shekhar Gupta,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-03-13 15:20:05

En Interface Builder, establezca la propiedad Secure CheckBox

O

En el conjunto de códigos

Objetivo-C:

yourTextField.secureTextEntry = YES;

Swift:

yourTextField.secureTextEntry = true
 35
Author: iPrabu,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-01-06 06:47:36

Establezca la propiedad secureTextEntry en YES.

 9
Author: jtbandes,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-07-05 06:48:07

Abra el archivo Xib y abra el inspector del campo de texto de contraseña y marque la propiedad secure.

 7
Author: PgmFreek,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-07-05 07:14:28

Para Swift 3.0:

txtpassword.isSecureTextEntry = true
 5
Author: somnath,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-04-06 07:32:31

Simplemente marque la casilla Secure Text Entry en el guion gráfico

introduzca la descripción de la imagen aquí

 2
Author: Fangming,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-07-13 17:26:32

En Swift 3.0 o posterior

passwordTextField.isSecureTextEntry = true
 2
Author: kishu mewara,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-08-29 13:21:09
    txt_Password = new UITextField {
        Frame = new RectangleF (20,40,180,31),
        BorderStyle = UITextBorderStyle.Bezel,
        TextColor = UIColor.Black,
        SecureTextEntry = true,
        Font = UIFont.SystemFontOfSize (17f),
        Placeholder = "Enter Password",
        BackgroundColor = UIColor.White,
        AutocorrectionType = UITextAutocorrectionType.No,
        KeyboardType = UIKeyboardType.Default,
        ReturnKeyType = UIReturnKeyType.Done,
        ClearButtonMode = UITextFieldViewMode.WhileEditing,
    };

SecureTextEntry establece true.

 1
Author: kiran,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-07-08 08:36:05