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

更新到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).

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容