横向中的 UISearchBarDelegate 不起作用

发布于 2024-11-15 18:26:16 字数 108 浏览 5 评论 0原文

很简单,我正在实现 UISearchBarDelegate,但在横向模式下它看起来是错误的。搜索栏并没有一直延伸到正确的位置。 UISearchBarDelegate 不应该在横向中使用还是有解决方案?

Quite simply, I'm implementing UISearchBarDelegate, but in landscape mode it looks wrong. The search bar doesn't stretch all the way right. Is UISearchBarDelegate not suppose to be used in landscape or is there a solution?

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

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

发布评论

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

评论(1

变身佩奇 2024-11-22 18:26:16

问题不太可能出在代表身上。可能是 autoresizingMask 设置不正确。应该是,

searchBar.autoresizingMark = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin;

It's highly unlikely that the problem is with the delegate. It's probably that the autoresizingMask isn't set properly. It should be,

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