UIScrollView 中的 UIStackView 被切断 [英] UIStackView within UIScrollView is cut off

查看:33
本文介绍了UIScrollView 中的 UIStackView 被切断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 UIScrollView 中使用 UIStackView,我希望有人能指出我创建正确约束的正确方向,因为我无法弄清楚问题是什么.

I'm trying to use a UIStackView within a UIScrollView and I was hoping someone could point me in the right direction in creating the right constraints because I can't figure out what the problem is.

这些是我的约束和 ViewController 结构.

These are my constraints and ViewController structure.

因此 DestCont 是一个具有固定高度的 UIView,而 ContentCont 应占据其余空间,该空间可能(并且)大于屏幕,因此它应该能够滚动.

So DestCont is a UIView that has a fixed height and ContentCont should take up the rest of the space, which could be (and is) larger than the screen so it should be able to scroll.

当我在模拟器中测试时,我遇到了以下问题.(调整大小使其适合 2MB 上限)

When I test it out in the simulator, I have the following problem. (Resized it so it would fit in the 2MB cap)

绿色是根视图,黑色是滚动视图,如您所见,它切断了 ContentCont 视图的底部.

The green is the Root View and the black color is the ScrollView, as you can see, it cuts off the bottom portion of the ContentCont view.

编辑

我更改了约束,删除了固定的 UIStackView 高度,但是现在,它没有显示 UIStackView 中的底部 UIView:

I changed the constraints, removed the fixed UIStackView height, but now, it doesn't show the bottom UIView that's in the UIStackView:

推荐答案

我最终得到了很好的结果,只是我的ContentCont" UIContainerView 将使用以下教程滚动并修复切换:https://spin.atomicobject.com/2015/09/02/switch-container-views/.

I ended up with being fine that just my "ContentCont" UIContainerView will scroll and fixed the switching by using the following tutorial: https://spin.atomicobject.com/2015/09/02/switch-container-views/.

这篇关于UIScrollView 中的 UIStackView 被切断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆