如图 search bar 下面的黄色区域如何去除(UISearchController的searchResultsController 是uitableviewcontroller 的子类,我把背景色设成了黄色)
UI是用storyboard 完成
已尝试
automaticallyAdjustsScrollViewInsets = false
tableView.tableHeaderView = UIView()
tableView.tableFooterView = UIView()
达不到理想效果
理想效果是searchbar 和呈现搜索结果的tableview 之间没有空白区域
![图片描述][2]
谢谢各位回答者,此问题已解决。在viewdidload中加一句definesPresentationContext = true
就行了。definesPresentationContext默认为false如果不设为true 会出现各种问题
这是在Apple的sample code里找到的
你的 tableView 用 plain style,不要 group
应该就是tableView的y值设置的不合适.可以适当减小或者动态打印下tableView的frame看一下.另外,推荐使用 xcode视图工具,看一视图的层次结构.如图.