ios – 是什么让searchDisplayController显示scopeBar?

前端之家收集整理的这篇文章主要介绍了ios – 是什么让searchDisplayController显示scopeBar?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我知道有一个属性searchDisplayController.searchBar.showsScopeBar,但在我的发现中,即使我们将showsScopeBar设置为NO,但将其searchDisplayController.searchBar.scopeButtonTitles属性设置为某个数组,范围栏也会显示指定的标题.将showsScopeBar设置为YES,并将scopeButtonTitles设置为nil,不显示scopeBar.

所以,我认为showsScopeBar属性实际上没用,但显示或隐藏scopeBar实际上取决于我们是否将数组设置为scopeButtonTitles属性.

这有可能吗?或者我错过了其他的东西.

解决方法

确保您的UISearchBar在范围栏出现时有空间扩展.我把UISearchBar放在一个320x44px的固定框架内并且当示波器栏打开时我犯了一个错误,它只是没有空间可见(320x88px).此外,UISearchBar在表的标题视图中也必须被告知刷新.

[self.tableView beginUpdates];
[self.searchBar setShowsScopeBar:YES]; 
[self.tableView endUpdates];

猜你在找的iOS相关文章