self.passwordTF.tintColor = [UIColor whiteColor];// 设置光标颜色
// 创建一个富文本对象
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
// 设置富文本对象的颜色
attributes[NSForegroundColorAttributeName] = [UIColor colorWithHexString:@"#FFFFFF"];
// 设置UITextField的占位文字及占位文字的颜色
self.passwordTF.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"密码" attributes:attributes];
// 设置边框颜色
self.passwordTF.layer.borderColor= [UIColor colorWithHexString:@"#1380C5"].CGColor;
self.passwordTF.layer.borderWidth= 1.0f;
self.passwordTF.layer.cornerRadius = 4;
self.passwordTF.clipsToBounds = YES;
// 如何设置文本距离文本框左边有10的间距
// 设置文本距离左边有10的间距
self.passwordTF.leftView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 10, 0)];
//设置显示模式为永远显示(默认不显示)
self.passwordTF.leftViewMode = UITextFieldViewModeAlways;
网友评论