首先总体效果如下显示
Paste_Image.png“手机号”、“验证码”居左10像素,背景为白色,文字为白色
首先设置默认文字居左10像素显示
UILabel *numLble = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 60, phoneCodeField.frame.size.height)];
numLble.text = @"手机号";
numLble.textColor = [z_UI colorWithHexString:@"5b2f22"];
numLble.textAlignment = 1;
numLble.font = DEFAULT_FONT(14);
phoneField.leftView = numLble;
phoneField.leftViewMode = UITextFieldViewModeAlways;
leftView显示的位置,居左,
leftViewMode
typedef NS_ENUM(NSInteger, UITextFieldViewMode) {
UITextFieldViewModeNever,
UITextFieldViewModeWhileEditing,
UITextFieldViewModeUnlessEditing,
UITextFieldViewModeAlways
};
其次:设置背景白色,字体白色
phoneCodeField.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.4f];
phoneCodeField.textColor = [z_UI colorWithHexString:@"#ffffff"];
colorWithAlphaComponent 设置背景的透明度这样就可以显示白色文字
网友评论