简体   繁体   English

为什么 StackViews 没有内在的内容大小?

[英]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.

相关问题 UIStackView 的子视图具有固有大小,但仍然忽略内容拥抱优先级 - UIStackView's subviews have intrinsic size, yet still ignore content hugging priorities 为什么将useSingleLineMode设置为YES的NSTextField具有多行文本的固有内容大小? - Why does NSTextField with usesSingleLineMode set to YES has intrinsic content size of multiline text? uistackview中具有固有内容大小的自定义视图 - Custom view with intrinsic content size in uistackview 添加填充到内在内容大小不适用于UILabel - Add padding to Intrinsic Content Size not working in UILabel 没有内在内容大小的 UIViews 的拥抱/压缩? - Hugging/compression for UIViews without intrinsic content size? 故事板上的UIStackView强制固有内容的大小 - UIStackView in storyboard forces intrinsic content size UIViewRepresentable 及其内容的内在大小 - UIViewRepresentable and its content's intrinsic size iOS-大小类的不同stackviews - iOS - Different stackviews for size classes 带有按比例填充的子视图和固有宽度的iOS StackViews行为异常 - iOS StackViews with proportionally filled Subviews and intrinsic width not behaving as expected 有没有办法以编程方式让UILabel确定其固有内容的大小 - Is there a way to programmatically let a UILabel determine its intrinsic content size
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM