UITextfiled 设置输入前面空格

  [self  setTextFieldLeftPadding:_searchTX forWidth:10]; //前面空格10

 

#pragma mark  设置uitextfiled前面空格

-(void)setTextFieldLeftPadding:(UITextField *)textField forWidth:(CGFloat)leftWidth

{

    CGRect frame = textField.frame;

    frame.size.width = leftWidth;

    UIView *leftview = [[UIView alloc] initWithFrame:frame];

    textField.leftViewMode = UITextFieldViewModeAlways;

    textField.leftView = leftview;

}

posted on 2017-05-02 10:17  廖利君  阅读(137)  评论(0编辑  收藏  举报