TextField如何更改placeHolder左间距

UITextField*tfPhone          = [[UITextFieldalloc]init];

tfPhone.leftView= [[UIViewalloc]initWithFrame:CGRectMake(0,0,15,40)];

tfPhone.leftViewMode=UITextFieldViewModeAlways;

self.tfPhone= tfPhone;

tfPhone.delegate=self;

tfPhone.backgroundColor=UIColorFromRGBWithAlpha(0xd5d5d5,1.0);

NSMutableParagraphStyle*style = [tfPhone.defaultTextAttributes[NSParagraphStyleAttributeName]mutableCopy];

style.minimumLineHeight= tfPhone.font.lineHeight- (tfPhone.font.lineHeight- [UIFontsystemFontOfSize:14].lineHeight) /2.0;

tfPhone.attributedPlaceholder= [[NSAttributedStringalloc]initWithString:@"请输入您的手机号"attributes:@{NSParagraphStyleAttributeName: style,NSFontAttributeName: [UIFontsystemFontOfSize:14],NSForegroundColorAttributeName:UIColorFromRGBWithAlpha(0x878787,1.0)}];

tfPhone.textColor=UIColorFromRGBWithAlpha(0x878787,1.0);

[selfaddSubview:tfPhone];

tfPhone.layer.cornerRadius     =5;

tfPhone.layer.masksToBounds    =YES;

你可能感兴趣的:(TextField如何更改placeHolder左间距)