如何使ScrollView全屏?我放置了必要的约束,但这没有工作

发布于 2025-01-20 06:24:41 字数 477 浏览 7 评论 0原文

我正在尝试制作一个 ScrollView ,以便其大小适应文本的大小。我放置了所有必要的约束

在此处输入图像描述

,但是当应用程序显示在模拟器上时,内容视图从安全区,也最终到达安全区。尽管我已将滚动视图固定到超级视图,并将内容视图固定到滚动视图。

我希望内容不是从安全区域开始,如这里 在此处输入图像描述

而是从屏幕开头开始这里

在此处输入图像描述

换句话说,我想删除顶部和底部的蓝色条

在此处输入图像描述

您有什么想法吗?

I'm trying to make a ScrollView so that its size adjusts to the size of the text. I placed all the necessary constraints

enter image description here

, but when the application is displayed on the simulator, the content view starts from the safe area and also ends up to the safe area. Although I have pinned scroll view to superview and content view to scroll view.

I want the content to start not from the safe area like here enter image description here,

but from the start of the screen like here

enter image description here

in other words, I want to remove the blue bar from the top and bottom

enter image description here

Do you have any ideas how to do it?

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

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

发布评论

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

评论(1

留一抹残留的笑 2025-01-27 06:24:41

有时 UITableView &即使您将视图附加到超级视图的顶部,UIScrollView 仍然可以显示安全区域。您只需要添加一行即可解决此问题,但请确保您的 ScrollView 连接到 superView 而不是顶部的安全区域。
将scrollView添加到您的ViewController并在viewDidLoad()中只需编写:

scrollView.ContentInsetAdjustmentBehavior = .never

检查此答案以获取更多详细信息: Make UITableView忽略安全区域

Sometimes UITableView & UIScrollView can still show safe area even though you attach your View to top of Super View. You just need to add one line to solve this issue but make sure your ScrollView is connected to superView not safe area at the top.
Add scrollView to your ViewController and in viewDidLoad() just write:

scrollView.ContentInsetAdjustmentBehavior = .never

Check this answer for further details: Make UITableView ignore Safe Area

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