如何在没有 UISearchDisplayController 的情况下为 UISearchBar 滑入和滑出视图设置动画?

发布于 2024-08-13 12:51:45 字数 296 浏览 2 评论 0原文

我有一个视图,它有一个按钮,可以使用

searchBar.hidden = !searchBar.hidden;

搜索栏切换 UISearchBar ,并查询 Web 服务以获取结果,然后将它们显示给用户,而无需使用 UITableView > 或本地数据源或任何东西。因此,我真的不想使用 UISearchDisplayController 来制作动画。

有没有办法在不手动编码动画的情况下为这种滑动设置动画?

谢谢!

I have a view that has a button which toggles a UISearchBar using

searchBar.hidden = !searchBar.hidden;

The searchbar goes out and queries a web service to get results and then displays them to the user without ever using a UITableView or a local datasource or anything. As such I don't really want to use a UISearchDisplayController to do the animation.

Is there anyway to animate this sliding without manually coding up the animation?

Thanks!

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

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

发布评论

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

评论(1

轻拂→两袖风尘 2024-08-20 12:51:45

继续使用 UISearchDisplayController。它不是一个非常重的物体。您编写的用于替换其功能的任何代码肯定会比 UIKit 中已有的类实例占用更大的空间。

Go ahead and use the UISearchDisplayController. It's not a terribly heavyweight object. Any code you write to replace its functionality is certainly going to have a bigger footprint than an instance of a class you've already got in the UIKit.

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