CGRect frame = f;//f表示你的textField的frame frame.size.width = ;//设置左边距的大小 UIView *leftview = [[UIView alloc] initWithFrame:frame]; textField.leftViewMode = UITextFieldViewModeAlways;//设置左边距显示的时机,这个表示一直显示 textField.leftView = leftview;