UISTackView没有有用的ReadableContentGuide

时间:2017-12-21 13:20:29

标签: ios autolayout uistackview

我使用AddArrangedSubView将SubView添加到垂直UIStackView。默认情况下,这些视图位于左右边缘。

我可以设置

LayoutMargins = new UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15),
LayoutMarginsRelativeArrangement = true

这将给我15px的左右填充。这很棒,但我真正想要的是左右填充由ReadableContentGuide控制。这适用于UITableView,该属性可在UIStackView上使用,但其边距为0.

如何获得具有当前设备和方向的正确值的UILayoutGuide

1 个答案:

答案 0 :(得分:0)

来自日志的UIStacView(宽度:200,高度110)中的错误

- "UIViewReadableContentGuide", layoutFrame = {{0, 0}, {200, 110}}, owningView = <UIStackView: 0x10380afc0; frame = (87.5 146; 200 110); opaque = NO; autoresize = RM+BM; layer = <CATransformLayer: 0x1c4028de0>>>

当日志UITextView(宽度:240,高度128)

-  "UIViewReadableContentGuide", layoutFrame = {{8, 8}, {224, 112}}, owningView = <UITextView: 0x103002a00; frame = (67.5 279.5; 240 128); text = 'Some html string '; clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x1c4458450>; layer = <CALayer: 0x1c4034440>;