首页 > 代码库 > textField常用的属性
textField常用的属性
UITextField *textF = [[UITextField alloc]initWithFrame:CGRectMake(0, kFitH(100), kScreenWidth, kFitH(60))];
textF.backgroundColor = [UIColor whiteColor];
textF.placeholder = @" 输入手机号码";
textF.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
//设置placeholder的字体
[textF setValue:[UIFont fontWithName:kFontPingFangMedium size:kFitFontSize(32)] forKeyPath:@"_placeholderLabel.font"];
//设置文字的字体
textF.font = [UIFont fontWithName:kFontPingFangMedium size:kFitFontSize(32)];
//设置光标的颜色
textF.tintColor = [UIColor grayColor];
//设置光标左移
UIView *leftVie = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 10, 0)];
textF.leftView = leftVie;
//设置左边view的显示方式
textF.leftViewMode = UITextFieldViewModeAlways;
textField常用的属性