#802 NSGenericException Access to UITextField's _placeholderLabel ivar is prohibited.

根據bugly反饋的信息我查看代碼看到:

[self.searchTF setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];

這段代碼的意思是設置textField文字的默認顏色。iOS13以後就不能這樣寫了,應該這樣寫:

Ivar ivar =  class_getInstanceVariable([UITextField class], "_placeholderLabel");
UILabel *placeholderLabel = object_getIvar(self.searchTF, ivar);
placeholderLabel.textColor = [UIColor whiteColor];

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章