隐藏UITextField密码

时间:2011-07-05 06:45:18

标签: ios swift iphone security ipad

我正在做一个登录页面。我有UITextField密码。

显然,我不希望看到密码;相反,我希望圈子在打字时显示。 你如何设置这个领域?

9 个答案:

答案 0 :(得分:307)

请将您的UItextField属性设置为安全..

试试这个..

textFieldSecure.secureTextEntry = true

textFieldSecure是您的UITextField ...

答案 1 :(得分:80)

可以为Obscure UITextField密码执行此操作:

enter image description here

<强> CODE

<强>目标-C:

  textField.secureTextEntry = YES;

<强>夫特:

  textField.isSecureTextEntry = true 

答案 2 :(得分:37)

在Interface Builder中设置Secure CheckBox属性

在代码集

<强>目标-C:

yourTextField.secureTextEntry = YES;

<强>夫特:

yourTextField.secureTextEntry = true

答案 3 :(得分:11)

secureTextEntry属性设置为YES

答案 4 :(得分:8)

打开Xib文件并打开密码文本字段的检查器并勾选安全属性。

答案 5 :(得分:6)

对于Swift 3.0:

txtpassword.isSecureTextEntry = true

答案 6 :(得分:3)

Swift 3.0或更高版本中的

passwordTextField.isSecureTextEntry = true

答案 7 :(得分:3)

只需选中故事板上的import java.io.*; import java.util.Scanner; import java.lang.StringBuilder; import java.io.File; import java.io.FileInputStream; public class fileWriting{ public static void main(String[] args) throws IOException{ //Set everything up to read & write files //Create new file(s) File accInfo = new File("accountInfo.txt"); //Create FileWriter Scanner in = new Scanner(new FileReader("accountInfo.txt")); String fileString = ""; //read from text file to update current information into program StringBuilder sb = new StringBuilder(); while(in.hasNext()) { sb.append(in.next()); } in.close(); fileString = sb.toString(); System.out.println(fileString); } } 复选框

即可

Nolan Royalty's

答案 8 :(得分:2)

    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设置为true。