The first 38 months on the 8th day ios13 _placeholderLabel

1.

"NSGenericException" - reason: "Access to UITextField's _placeholderLabel ivar is prohibited. This is an application bug"

Set TextFiled default text color in iOS13 Crash.

[textfield setValue: [UIColor whiteColor] forKeyPath: @ "_ placeholderLabel.textColor"];
 checked, a lot of posts, the solution:

Ivar ivar = class_getInstanceVariable([UITextField class], "_placeholderLabel");
UILabel *placeholderLabel = object_getIvar(textField, ivar);
placeholderLabel.textColor = [UIColor whiteColor];
记得加头文件

#import <objc/runtime.h>

 

https://blog.csdn.net/Han_Laomo/article/details/101111427

Guess you like

Origin www.cnblogs.com/javastart/p/11819177.html