美文网首页
ios13 设置textField中占位字符颜色的问题

ios13 设置textField中占位字符颜色的问题

作者: 的的可可 | 来源:发表于2020-03-13 13:57 被阅读0次

更新到iOS13后发现原来手写代码textField中占位字符颜色那里出现bug导致程序意外退出。报错Access to UITextField's _placeholderLabel ivar is prohibited. This is an application bug。原代码为

[passWordField setValue:[UIColor lightGrayColor] forKeyPath:@"_placeholderLabel.textColor"];

简单解决办法为去掉那个下划线。原因如下
In iOS 13, we can not use KVC(valueForKey:, setValue:forKey:) to access some private APIs, it causes the crash of UISearchBar (QMUI), UINavigationBar (QMUI) and UITabBar (QMUI).

相关文章

网友评论

      本文标题:ios13 设置textField中占位字符颜色的问题

      本文链接:https://www.haomeiwen.com/subject/gqchshtx.html