Please set your UItextField property secure..
Try this..
textFieldSecure.secureTextEntry = true
textFieldSecure is your UITextField...
One can do this for Obscure a UITextField password:
https://i.stack.imgur.com/degAl.png
CODE
Objective-C:
textField.secureTextEntry = YES;
Swift:
textField.isSecureTextEntry = true
In Interface Builder check the "Secure Text Entry" checkbox
or
In code set:
Objective-C:
yourTextField.secureTextEntry = YES;
Swift:
yourTextField.secureTextEntry = true
Set the secureTextEntry
property to YES
.
Open the Xib file and open the inspector of the password text field and tick the secure property.
For Swift 3.0:
txtpassword.isSecureTextEntry = true
in Swift 3.0 or later
passwordTextField.isSecureTextEntry = true
Simply check Secure Text Entry
check box on the storyboard
https://i.stack.imgur.com/PPsEt.gif
textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String)
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.
Success story sharing