How to change placeholder text color in xib?

后端 未结 4 496
轮回少年
轮回少年 2021-02-02 12:13

How to change placeholder text color in xib ? I have tried key path thing but it is giving me NSException. Can anyone please help.

4条回答
  •  别跟我提以往
    2021-02-02 12:58

    We cannot change textcolor of placeholder text in storyboard. Manually we can change with the property name.

    Addthis code in viewDidLoad

    [nameTextField setValue:[UIColor colorWithRed:41.0/255.0 green:91.0/255.0 blue:106.0/255.0 alpha:1.0] forKeyPath:@"_placeholderLabel.textColor"];
    

提交回复
热议问题