2009-09-08

Create a password field in an iPhone application

    The code is same as the code to create a normal Text Box except for only one difference.

    //Initialize the Text Box with X, Y locations and Width and Height
    passWordText=[[UITextField alloc] initWithFrame:CGRectMake(160, 160, 150, 31)];
    [passWordText setBorderStyle:UITextBorderStyleRoundedRect];
    [passWordText setDelegate:self];
    [passWordText setKeyboardType:UIKeyboardTypeAlphabet];

    // Make the Text Box to Password field
    passWordText.secureTextEntry=YES;

    // Add the password field to Main View

    [logView addSubview:passWordText];

No comments: