UISearchBar 框架使 x 难以按下

发布于 2024-09-17 19:02:45 字数 284 浏览 5 评论 0原文

我的 UINavigationBar 中有一个 UISearchBar,其中也有一个按钮。当您单击搜索字段时,按钮会变大一点以容纳文本,而搜索字段会变小以为其腾出空间。

尽管就视觉 UI 而言这看起来很完美,但用于清除搜索字段的 x 几乎无法单击。

来设置框架

self.navigationController.navigationBar.bounds;

我通过每次改变尺寸 。我应该使用什么来使搜索栏的 x 可以点击?

为任何帮助干杯

I have a UISearchBar in my UINavigationBar that also has a button in it. When you click the search field the button gets a bit larger to accommodate text and the search field gets smaller to make space for it.

Although this looks perfect as far as visual UI is concerned the x to clear the search field is almost unclickable.

I am setting the frame by doing

self.navigationController.navigationBar.bounds;

every time the size is meant to change. What should I use instead so that the search bar's x is clickable?

Cheers for any help

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

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

发布评论

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

评论(1

情丝乱 2024-09-24 19:02:45

嗯,简单的解决方案,我应该设置边界而不是框架

Well simple solution, I should be setting the bounds rather than the frame

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