How do you obscure text in a password field in an iPhone Application? How do you obscure text in a password field in an iPhone Application? objective-c objective-c

How do you obscure text in a password field in an iPhone Application?


I don't really understand your question, but I'm guessing you want a UITextField which displays dots for the characters, which every password field on the iPhone does. For this, you want to set the secureTextEntry property of that UITextField (UITextField has such a property because it conforms to the UITextInputTraits protocol) to YES:

textfield.secureTextEntry = YES;


You can also set this in Interface Builder. Select your text field, and check the "secure" setting in the inspector.

secure setting in Interface Builder


You can add a key path secureTextEntry of type Boolean and tick it in the User defined runtime attributes in the Identity Inspector.

enter image description here