简体   繁体   English

iOS:如果我将UILabel添加到UIView,则视图是否具有标签的固有内容大小?

[英]iOS: if I add UILabel to a UIView, will the view has intrinsic content size of the label?

如标题所述,我需要在一个容器视图中有几个标签,说这些标签是一个接一个地水平对齐的,容器视图是否具有正确的固有内容大小,还是我必须继承UIView并手动计算它?

不,但是如果您使用自动布局,则无需子类即可实现(我的意思是正确的大小,我认为这不会为您计算内在大小)

暂无
暂无

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

相关问题 如何在UILabel的内在内容大小中添加填充? - How can I add padding to the intrinsic content size of UILabel? 添加填充到内在内容大小不适用于UILabel - Add padding to Intrinsic Content Size not working in UILabel iOS - 自定义视图:在 layoutSubviews() 中更新后忽略固有内容大小 - iOS - Custom view: Intrinsic content size ignored after updated in layoutSubviews() Swift iOS-如何设置UIView的高度锚&lt;=到标签的内在文本大小? &#39;NSLayoutConstraint&#39;不能转换为&#39;Bool&#39; - Swift iOS -How to set UIView's Height Anchor <= To A Label's Intrinsic Text Size? 'NSLayoutConstraint' is not convertible to 'Bool' 有没有办法以编程方式让UILabel确定其固有内容的大小 - Is there a way to programmatically let a UILabel determine its intrinsic content size 如何仅使用情节提要使 UILabel 的 UIView 超级视图适合 UILabel 的固有高度? - How do I make the UIView superview of a UILabel fit the intrinsic height of the UILabel using the storyboard only? iOS-UIView子视图的大小与超级视图不同 - iOS - UIView subview has different size than super view 如何将scrollView嵌入UIViewController的视图顶部,并添加内部包含内容的自定义UIView? - How can I embed scrollView on top of UIViewController's view and add custom UIView which has content inside? iOS 13 测试版中 WKWebView 的内在内容大小问题 - WKWebView's Intrinsic Content Size issue in iOS 13 beta 如何正确地在具有固有内容大小的视图之间进行约束? - How correctly make constraints between view with intrinsic content size?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM