修改UITextfield的Placeholder字体的颜色

  //第一种 修改属性attribute

    UIColor *color = [UIColorwhiteColor];

    UITextField* _userName = [UITextFieldnew];

    _userName.attributedPlaceholder = [[NSAttributedStringalloc]initWithString:@"用户名"attributes:@{NSForegroundColorAttributeName:      color}];


  //第二种 KVC

    [_userName setValue:[UIColorwhiteColor]forKeyPath:@"_placeholderLabel.textColor"];

你可能感兴趣的:(OC)