programing

UITextField 암호 숨기기

elseif 2023. 4. 14. 21:15

UITextField 암호 숨기기

로그인 페이지를 하고 있습니다.패스워드에 UITextField가 있습니다.

물론 비밀번호는 표시하지 않고 동그라미를 쳐야 합니다.이러한 상황이 발생하려면 어떻게 해야 합니까?

UItextField 속성을 안전하게 설정하십시오.

이거 드셔보세요.

textFieldSecure.secureTextEntry = true

textFieldSecure는 UITextField...

새로운 Swift 버전에서는textFieldSecure.isSecureTextEntry = true

UITextField 암호의 경우 다음을 수행할 수 있습니다.

여기에 이미지 설명 입력

코드

목표-C:

textField.secureTextEntry = YES;

신속:

textField.isSecureTextEntry = true 

Interface Builder에서 "Secure Text Entry" 확인란을 선택합니다.

또는

코드 세트:

목표-C:

yourTextField.secureTextEntry = YES;

신속:

yourTextField.secureTextEntry = true

설정secureTextEntry의 재산.YES.

Xib 파일을 열고 암호 텍스트 필드의 검사기를 열고 보안 속성을 선택합니다.

Swift 3.0의 경우:

txtpassword.isSecureTextEntry = true

Swift 3.0 이후

passwordTextField.isSecureTextEntry = true

간단히 확인Secure Text Entry스토리보드 체크박스

여기에 이미지 설명 입력

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로 설정됩니다.

언급URL : https://stackoverflow.com/questions/6578824/obscure-a-uitextfield-password