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];

本文介绍如何使用Swift对UITextField进行自定义样式设置,包括边框、颜色及placeholder的颜色。
1459

被折叠的 条评论
为什么被折叠?



