UITextField *textField = [[UITextFieldalloc]initWithFrame:CGRectMake(10,200,300,50)];
textField.borderStyle=UITextBorderStyleRoundedRect;
textField.placeholder =@"<EnterText>";
textField.textAlignment=UITextAlignmentCenter;
[self.viewaddSubview:textField]; }
纯手写的
mPasswordField = [[UITextFieldalloc]initWithFrame:CGRectMake(110,185, 150, 30)];
mPasswordField.delegate= self;
mPasswordField.secureTextEntry=YES;
[mPasswordFieldsetClearButtonMode:UITextFieldViewModeWhileEditing];
[mPasswordField setPlaceholder:@"请输入密码"];
[mPasswordFieldsetBorderStyle:UITextBorderStyleRoundedRect];
[mPasswordFieldsetReturnKeyType:UIReturnKeyGo];
[mPasswordFieldsetContentVerticalAlignment:UIControlContentVerticalAlignmentCenter];
// [mPasswordField.layer setBackgroundColor:[[UIColor whiteColor]CGColor]];
// [mPasswordField.layer setBorderColor:[[UIColorcolorWithRed:13.0/255.0 green:132.0/255.0 blue:188.0/255.0alpha:1.0] CGColor]];
// [mPasswordField.layer setBorderWidth:0.8];