一. UISearchBar
UISearchBar的 _searchField 私有屬性去掉了, 但它的getter searchBarTextField 還在,可以用KVC獲取到
[self valueForKey:@"searchBarTextField"]
而且新增加了一個(gè) searchTextField 方法獲取UISearchTextField對(duì)象(是的UISearchTextField公開(kāi)了, 兩個(gè)方法名只差了一個(gè)Bar, 蘋果有必要這樣嗎),然而searchTextField方法沒(méi)有標(biāo)記iOS13伞剑, 估計(jì)是蘋果忘了, 或者改錯(cuò)名字了, searchBarTextField和searchTextField獲取到的是同一個(gè)對(duì)象
同時(shí)UITextField的私有屬性_placeholderLabel被禁止訪問(wèn)了帮碰,用kvc獲取會(huì)報(bào)錯(cuò):
exception: Access to UITextField's _placeholderLabel ivar is prohibited. This is an application bug
但可以用
[searchField performSelector:@selector(_placeholderLabel)]獲取到
UISearchTextField多了一層backgroundView, 默認(rèn)灰色圓角, 而且還不能改, 去掉的方法是:
[self.searchTextField performSelector:@selector(_clearBackgroundViews)];
_clearBackgroundViews這個(gè)方法從iOS8就有了