[英]Why do StackViews not have intrinsic content size?
I've always wondered why UIStackviews don't have an intrinsic content size?我一直想知道为什么 UIStackviews 没有固有的内容大小? What is Apple's reasoning for not having them calculate the intrinsic content size like a normal View does? Apple 不让他们像普通 View 那样计算内在内容大小的理由是什么?
I use stackViews in autoresizing tableView cells, and I usually have to custom subclass the StackView to make the intrinsic content size be calculated correctly.我在自动调整 tableView 单元格中使用 stackViews,并且我通常必须自定义 StackView 的子类以正确计算内部内容大小。
它确实具有分配类型.fill
的内在内容大小,但这需要子视图具有内在内容大小,如标签和按钮,否则给它们一个高度,还要确保在单元格内从上到下正确挂钩约束
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.