0

我的导航栏中有一个搜索栏,使用

[self.searchDisplayController setDisplaysSearchBarInNavigationBar:YES];

当点击搜索栏时,它会显示一个搜索结果视图,但搜索结果视图中没有取消按钮。你能给我建议以编程方式执行吗

我必须以编程方式进行。

请任何人帮我一把。

提前谢谢

4

1 回答 1

0

您应该能够使用:

[self.searchDisplayController.searchBar setShowsCancelButton:YES animated:YES]

我自己正在使用这样的东西(实现 UISearchDisplayDelegate):

- (void)searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller {
  [controller.searchBar setShowsCancelButton:YES animated:YES];
}
于 2014-06-05T06:35:42.003 回答