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