Uitableview UISearchBarController在调用返回按钮后不隐藏

Uitableview UISearchBarController在调用返回按钮后不隐藏,uitableview,uiviewcontroller,uisearchbar,uisearchdisplaycontroller,uikeyboard,Uitableview,Uiviewcontroller,Uisearchbar,Uisearchdisplaycontroller,Uikeyboard,我有一个内置tableViewController的viewController。 我的问题是,当我按下返回按钮时,搜索栏不会消失,那么当我按下取消按钮时,搜索栏会消失什么呢。 你知道这个问题吗 谢谢如果您使用UISearchDisplayController,请尝试以下操作 [self.searchDisplayController setActive:NO animated:YES]; 调用操作时,按返回按钮执行。如果要关闭搜索界面(如搜索栏和“取消”按钮)。下一个代码执行此操作: [se

我有一个内置tableViewController的viewController。 我的问题是,当我按下返回按钮时,搜索栏不会消失,那么当我按下取消按钮时,搜索栏会消失什么呢。 你知道这个问题吗


谢谢

如果您使用UISearchDisplayController,请尝试以下操作

[self.searchDisplayController setActive:NO animated:YES];

调用操作时,按返回按钮执行。

如果要关闭搜索界面(如搜索栏和“取消”按钮)。下一个代码执行此操作:

[self.searchDisplayController setActive:NO animated:YES];
我发现了

我只是用了一个带控制器的UISearchBar