iOS13上通过KVC设置textField的placeholder的颜色崩溃
'NSGenericException', reason: 'Access to UITextField's _placeholderLabel ivar is prohibited. This is an application bug'
//添加头文件 #import <objc/runtime.h> [self.phoneTextField setValue: [UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"]; //修改为 Ivar ivar = class_getInstanceVariable([UITextField class], "_placeholderLabel"); UILabel *placeholderLabel = object_getIvar(textField, ivar); placeholderLabel.textColor = [UIColor whiteColor];
<style></style>