UITextField set placeholder color as dark in iOS

前端 未结 8 752
误落风尘
误落风尘 2021-02-01 10:59

I have tried to set UITextField \"Placeholder\" color as dark.

NSAttributedString * search = [[NSAttributedString alloc] initWithSt         


        
相关标签:
8条回答
  • 2021-02-01 11:37

    It will change textField's palceholder textColor

    [yourTextField setValue:[UIColor colorWithRed:150.0f/255.0f green:150.0f/255.0f blue:155.0f/255.0f alpha:1] forKeyPath:@"_placeholderLabel.textColor"];
    
    0 讨论(0)
  • 2021-02-01 11:41

    Here is Latest way to Change FONT and COLOR of placeholder text

        self.emailField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"Email" attributes:@{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName :[UIFont fontWithName:@"OpenSans" size:14.0]}];
    
    0 讨论(0)
提交回复
热议问题