我正在做一个登录页面。我有UITextField密码。
显然,我不希望看到密码;相反,我希望圈子在打字时显示。 你如何设置这个领域?
答案 0 :(得分:307)
请将您的UItextField属性设置为安全..
试试这个..
textFieldSecure.secureTextEntry = true
textFieldSecure是您的UITextField ...
答案 1 :(得分:80)
可以为Obscure UITextField密码执行此操作:
<强> 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)
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);
}
}
复选框
答案 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。