Search code examples
xcode4

How to create a password field in xcode


I am trying to make an iPhone App in which i will make user to login into their account. For this i want userID and Password from the user. My question is how i can make a password field in which whatever I enter will be shown as "*".


Solution

  • Sounds like you are looking for "setSecureTextEntry" on a "UITextField" object.

    Also known as the "secureTextEntry" property in the "UITextInputTraits" protocol.

    You can call this programatically via calling ".secureTextEntry = YES" on the "UITextField" object you want to be set for passwords.

    You can also set it in Interface Builder (look for "Secure" checkbox in your text field Attributes inspector). It looks like this:

    SecureAttributeForTextField

    And in newer version of Xcode:

    SecureAttributeForTextField In Newer Xcode