回答

0

甲UISearchDisplayController不能被添加到一个UIView,因为它不从一个UIView继承。您可以在Interface Builder中使用IBOutlet添加UISearchBar,然后以编程方式使用该UISearchBar创建UISearchDisplayController。

0

只需在代码中完成(假设视图控制器是VC):

[vc addSubview:mySearchDisplayController.searchBar]; 
// Note that searchBar is the view, and mySearchDisplayController only CONTROLS the searchBar etc.