调用SearchBar报错

2020-03-13  本文已影响0人  文心楠_YouHou

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"];

上一篇 下一篇

猜你喜欢

热点阅读