UITextField *textField=[[UITextFieldalloc] initWithFrame:CGRectMake(50,100, 200,50)];
textField.layer.borderWidth =0.5;
textField.layer.borderColor = [[UIColorgrayColor]CGColor];
//UITextField设置placeholder颜色
UIColor *color = [UIColorredColor];
textField.attributedPlaceholder = [[NSAttributedStringalloc]initWithString:@"密码"attributes:@{NSForegroundColorAttributeName: color}];
textField.delegate=self;
[self.viewaddSubview:textField];