UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
label.backgroundColor = [UIColor clearColor];label.textColor = [UIColor lightGrayColor];
label.text = @"Edit:";
UITextField *tf = [[UITextField alloc] initWithFrame:CGRectMake(50, 100, 150, 31)];
tf.borderStyle = UITextBorderStyleRoundedRect;
tf.leftViewMode = UITextFieldViewModeAlways;
tf.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
tf.leftView = label;
也可以在TextField的leftView上添加图片等我们想添加的东西