简体   繁体   English

uistackview中具有固有内容大小的自定义视图

[英]Custom view with intrinsic content size in uistackview

A custom view with overridden intrinsicContentSize property is added to a UIStackView 具有覆盖的internalContentSize属性的自定义视图被添加到UIStackView

 override var intrinsicContentSize: CGSize {
    return CGSize(width: 100, height: 44)
  }

故事板显示UIStackView现在缺少height属性。

Although the custom view is drawn successfully in the simulator, I still want to get rid of this storyboard error message. 尽管自定义视图已在模拟器中成功绘制,但我仍然希望摆脱此故事板错误消息。 Thank you 谢谢

It looks like you are missing the constraint of the stack view not the view added to the stack. 似乎您缺少堆栈视图的约束,而不是添加到堆栈的视图的约束。 Check the constraints of the stack. 检查堆栈的约束。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 故事板上的UIStackView强制固有内容的大小 - UIStackView in storyboard forces intrinsic content size UIStackView 分布,一个子视图的内在内容大小优先 - UIStackView distribution with intrinsic content size of one subview prioritised 如何在 Swift 中设置自定义视图的内在内容大小? - How to set a custom view's intrinsic content size in Swift? iOS - 自定义视图:在 layoutSubviews() 中更新后忽略固有内容大小 - iOS - Custom view: Intrinsic content size ignored after updated in layoutSubviews() NSGridView 自定义视图固有大小 - NSGridView custom view intrinsic size UIStackView 的子视图具有固有大小,但仍然忽略内容拥抱优先级 - UIStackView's subviews have intrinsic size, yet still ignore content hugging priorities 如何正确地在具有固有内容大小的视图之间进行约束? - How correctly make constraints between view with intrinsic content size? 内容拥抱优先级不适用于 UIStackView 中的自定义视图和 label - Content hugging priority not working with custom view and label in UIStackView 添加填充到内在内容大小不适用于UILabel - Add padding to Intrinsic Content Size not working in UILabel 没有内在内容大小的 UIViews 的拥抱/压缩? - Hugging/compression for UIViews without intrinsic content size?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM