释放双眼,带上耳机,听听看~!
self.phoneField.font = [UIFont systemFontOfSize:15];
self.phoneField.placeholder =@"请输入";
// 通过init来创建初始化绝大部分控件,控件都是没有尺寸
UIImageView *icon = [[UIImageViewalloc] init];
icon.image = [UIImageimageNamed:@"phone"];
icon.width =30;
icon.height =30;
icon.contentMode =UIViewContentModeCenter;
self.phoneField.leftView =icon;
self.phoneField.leftViewMode = UITextFieldViewModeAlways;
/** ---------------------------------------------------------------------------*/
//设置无边框(可以直接在sb中设置)
// self.phoneField.borderStyle = UITextBorderStyleNone;
//手机号
self.phoneField.font = [UIFont systemFontOfSize:15];
self.phoneField.placeholder = @"请输入手机号";
UIView *line=[[UIView alloc]initWithFrame:CGRectMake(0,self.phoneField.height-2, self.phoneField.width, 1)];
line.backgroundColor=[UIColor lightGrayColor];
[self.phoneField addSubview:line];
// 通过init来创建初始化绝大部分控件,控件都是没有尺寸
UIImageView *searchIcon = [[UIImageView alloc] init];
searchIcon.image = [UIImage imageNamed:@"phone"];
searchIcon.width = 30;
searchIcon.height = 30;
searchIcon.contentMode = UIViewContentModeCenter;
self.phoneField.leftView = searchIcon;
self.phoneField.leftViewMode = UITextFieldViewModeAlways;
//密码
self.pwdField.font = [UIFont systemFontOfSize:15];
self.pwdField.placeholder = @"请输入密码";
UIView *line2=[[UIView alloc]initWithFrame:CGRectMake(0,self.pwdField.height-1, self.pwdField.width, 1)];
line2.backgroundColor=[UIColor lightGrayColor];
[self.pwdField addSubview:line2];
// 通过init来创建初始化绝大部分控件,控件都是没有尺寸
UIImageView *searchIcon2 = [[UIImageView alloc] init];
searchIcon2.image = [UIImage imageNamed:@"pwd"];
searchIcon2.width = 30;
searchIcon2.height = 30;
searchIcon2.contentMode = UIViewContentModeCenter;
self.pwdField.leftView = searchIcon2;
self.pwdField.leftViewMode = UITextFieldViewModeAlways;