调用SearchBar报错

iOS开发调用SearchBar报错:

 Access to UISearchBar's _searchField ivar is prohibited. This is an application bug'

出现原因: iOS 13 系统禁止通过 KVC 访问一些方式

UITextField*textfield = [searchBarvalueForKey:@"_searchField"];[textfieldsetValue:KFont(12)forKeyPath:@"_placeholderLabel.font"];

解决办法:

UITextField*textfield = [searchBarvalueForKey:@"searchField"];[textfieldsetValue:KFont(12)forKeyPath:@"placeholderLabel.font"];

你可能感兴趣的:(调用SearchBar报错)