美文网首页
textField设置文字距离左边的间隙

textField设置文字距离左边的间隙

作者: T_Choues | 来源:发表于2017-04-16 20:02 被阅读94次

    1、设置padding

    [textField setValue:@(5) forKey:@"paddingTop"];

    [textField setValue:@(5) forKey:@"paddingLeft"];

    [textField setValue:@(5) forKey:@"paddingBottom"];

    [textField setValue:@(5) forKey:@"paddingRight"];

    2、设置leftView

    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 15, CGRectGetHeight(textField.frame))];

    textField.leftView = view;

    textField.leftViewMode = UITextFieldViewModeAlways;

    相关文章

      网友评论

          本文标题:textField设置文字距离左边的间隙

          本文链接:https://www.haomeiwen.com/subject/izaaattx.html