UITextField的leftView

需要效果

UITextField的leftView_第1张图片

代码实现

 //给一个frame,可以限制图片的大小。不给也行,会显示图片原本大小。
    UIImageView *leftImgV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
    leftImgV.image = [UIImage imageNamed:@"currOrder_btn_delete_pre"];
    self.chongzhiTextField.leftView = leftImgV;
    self.chongzhiTextField.leftViewMode = UITextFieldViewModeAlways;

你可能感兴趣的:(UITextField的leftView)