tingxins / SakuraKit

🤡SakuraKit, a lightweight and powerful library for application to switching themes or skins.
https://tingxins.com/2017/08/ios-theme-skin-resolution/
MIT License
690 stars 116 forks source link

iOS13 UITextField的占位文字颜色修改问题 #15

Open obama901 opened 5 years ago

obama901 commented 5 years ago

之前可以通过kvc的私有方法获取到占位文字的UIlabel,但是现在不可以了,有什么解决办法吗?

coderchou commented 4 years ago

iOS 13禁止通过KVC设置placeholderLabel属性

//以下代码会崩溃
UIColor * color = [UIColor greenColor];
[textField setValue:color forKeyPath:@"_placeholderLabel.textColor"];

iOS 13系统直接设置 UITextFieldattributedPlaceholder 属性

obama901 commented 4 years ago

所以直接改attributedPlaceholder,要怎么和SakuraKit结合起来啊,之前获取Label可以用SakuraKit设置颜色,SakuraKit能设置NSAttributedString的颜色吗