ios 隐藏 UITextField 密码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6578824/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Obscure a UITextField password
提问by harsh_017
I am doing a login page. I have UITextField for password.
我正在做一个登录页面。我有 UITextField 作为密码。
Obviously, I do not want the password to be seen; instead, I want circles to show when typing. How do you set the field for this to happen?
显然,我不想看到密码;相反,我希望在输入时显示圆圈。你如何设置这个发生的领域?
回答by Mehul Mistri
Please set your UItextField property secure..
请设置您的 UItextField 属性安全..
Try this..
尝试这个..
textFieldSecure.secureTextEntry = true
textFieldSecure is your UITextField...
textFieldSecure 是您的 UITextField...
回答by Shekhar Gupta
One can do this for Obscure a UITextField password:
可以为 Obscure UITextField 密码执行此操作:


CODE
代码
Objective-C:
目标-C:
textField.secureTextEntry = YES;
Swift:
迅速:
textField.isSecureTextEntry = true
回答by iPrabu
In Interface Builder check the "Secure Text Entry" checkbox
在 Interface Builder 中选中“Secure Text Entry”复选框
or
或者
In code set:
在代码集中:
Objective-C:
目标-C:
yourTextField.secureTextEntry = YES;
Swift:
迅速:
yourTextField.secureTextEntry = true
回答by jtbandes
Set the secureTextEntryproperty to YES.
将secureTextEntry属性设置为YES。
回答by PgmFreek
Open the Xib file and open the inspector of the password text field and tick the secure property.
打开 Xib 文件并打开密码文本字段的检查器并勾选安全属性。
回答by somnath
For Swift 3.0:
对于 Swift 3.0:
txtpassword.isSecureTextEntry = true
回答by kishu mewara
in Swift 3.0 or later
在 Swift 3.0 或更高版本中
passwordTextField.isSecureTextEntry = true
回答by kiran
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 set true.
secureTextEntry 设置为真。

