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).

你可能感兴趣的:(ios13 设置textField中占位字符颜色的问题)