UITextField *tf1=[[UITextField alloc]initWithFrame:CGRectMake(10, 100, 200, 50)];
tf1.borderStyle=UITextBorderStyleRoundedRect;
tf1.backgroundColor=[UIColor whiteColor];
[self.view addSubview:tf1];
UIImageView *image=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"age_img"]];
// image.frame=CGRectMake(20, 0, 20, 20);
tf1.leftView=image;
tf1.leftView.backgroundColor=[UIColor orangeColor];
tf1.leftViewMode=UITextFieldViewModeAlways;
左侧图片紧挨着左侧边框,距离不可调整,显得比较紧凑