美文网首页
调用SearchBar报错

调用SearchBar报错

作者: 文心楠_YouHou | 来源:发表于2020-03-13 11:22 被阅读0次

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报错

      本文链接:https://www.haomeiwen.com/subject/ferqshtx.html