ios改变UITextField的placeholder的颜色

_txtF = [[UITextField alloc]initWithFrame:CGRectMake(0, 100, self.view.width, 30)];
_txtF.font = KFONT_14;
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:@"请输入内容" attributes:
    @{NSForegroundColorAttributeName:[UIColor redColor],
                    NSFontAttributeName:_txtF.font
    }];
_txtF.attributedPlaceholder = attrString;
[self.view addSubview:_txtF];

 

上一篇:IOS-textfield textview


下一篇:iOS-Swift-UItextField