高度和垂直位置对于UIStackView是不明确的 [英] height and vertical position are ambiguous for UIStackView

查看:158
本文介绍了高度和垂直位置对于UIStackView是不明确的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管添加了子视图,但Autolayout无法计算出UIStackView的高度或垂直位置。

Autolayout cannot figure out the height or vertical position of a UIStackView despite having added subviews.

这是一个非常常见的错误和陷阱,因此请参见下面的答案。

This is a pretty common error and "gotcha" so please see the answer below.

推荐答案

如果这是用于UIStackView,请确保您使用的是 addArrangedSubview 不是 addSubview

If this is for a UIStackView make sure you are using addArrangedSubview and not addSubview

这篇关于高度和垂直位置对于UIStackView是不明确的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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