0

如何将 UISearchDisplayController 添加到 UIView?界面生成器不会让我。

4

2 回答 2

0

A UISearchDisplayController cannot be added to a UIView because it doesn't inherit from a UIView. You can add a UISearchBar in Interface builder with an IBOutlet and then create a UISearchDisplayController with that UISearchBar programmatically.

于 2010-09-14T18:39:45.967 回答
0

只需在代码中执行,例如(假设视图控制器是 vc):

[vc addSubview:mySearchDisplayController.searchBar];
// Note that searchBar is the view, and mySearchDisplayController only CONTROLS the searchBar etc.
于 2010-09-14T17:56:10.937 回答