iOS-textField左侧添加图片/文本框的文字与左侧添加空隙

释放双眼,带上耳机,听听看~!
+(void)setTextFiledLeftImage:(UITextField*)textFiled image:(NSString*)image{

    textFiled.leftViewMode=UITextFieldViewModeAlways;

    textFiled.leftView=[[UIImageViewalloc]initWithImage:[UIImageimageNamed:image]];

}

用法:

[UtilssetTextFiledLeftImage:self.textFieldPassword1image:@"TextFileldPaaswordLeft5"];



// 在文本框左侧预留一些空隙

UILabel *paddingView = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 10, 25)];

paddingView.text = @" ";

paddingView.textColor = [UIColor darkGrayColor];

paddingView.backgroundColor = [UIColor clearColor];

textFiled.leftView = paddingView;

textFiled.leftViewMode = UITextFieldViewModeAlways;


————————————————

 

人已赞赏
iOS文章

iOS两个独立的App之间的跳转实现

2019-10-7 19:40:55

iOS文章

No accounts with iTunes Connect access have been found for the team

2019-10-7 22:52:00

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
有新消息 消息中心
搜索