从搜索显示控制器滚动结果时导航栏消失

发布于 2024-10-05 16:28:52 字数 564 浏览 0 评论 0原文

我有一个带有搜索栏和搜索显示控制器的视图。它是导航控制器的根视图。搜索显示控制器充当搜索栏的自动完成功能。 问题如下: 我在搜索栏中输入一个字母,然后会出现自动完成结果。我向下滚动到结果表视图的末尾。之后我改变主意,又输入了几个字母,直到表格中只剩下 3 个单词。我在表中选择一个结果。在 didSelectRowAtIndexPath 中,我保存了所选的值,并使用 setActive: FALSEanimated: TRUE 停用搜索显示控制器。当它停用时,导航栏会丢失。我做错了什么?

示例:我输入 H。出现一长串关键字。我向下滚动。我改变主意并输入OT,因此搜索栏中的文本现在是HOT,大约有。还剩 6 个关键字,我选择 HOTEL。当我回来时,导航栏消失了。我杀死了这个应用程序,因为它没用。下次我输入 HOT ;没有先向下滚动查看所有结果,然后选择HOTEL。这次可以了,导航栏还在。

编辑:我认为当我必须滚动结果时,如果只有一页结果可以正常工作,就会出现问题。

I have a view with a search bar and a search display controller. It is the root view of a navigation controller. The search display controller acts as an autocomplete for the search bar.
The problem is the following:
I enter a letter in the search bar and the autocomplete results appear. I scroll down to the end of the results table view. After that I change my mind and type in another few letters until there are only 3 words in the table. I select a result in the table. In the didSelectRowAtIndexPath I save the value that was selected and deactivate the search display controller using setActive: FALSE animated: TRUE. When it deactivates the navigation bar is missing. What did I do wrong?

Example: I type in H. A long list of keywords appear. I scroll down. I change my mind and type OT so the text in the search bar is now HOT there are approx. 6 keywords remaining, I select HOTEL. When I'm back the navigation bar is gone. I kill the app since it's useless. Next time I type in HOT ; without first scrolling down to see all the results, and after that I select HOTEL. This time it works, the navigation bar is still there.

EDIT: I think the problem appears when I have to scroll through the results if there is only one page of results it works ok.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

长伴 2024-10-12 16:28:52

使用 [self 解决了.navigationController setNavigationBarHidden:NO 动画: YES]

Solved by using [self.navigationController setNavigationBarHidden:NO animated: YES].

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文