1

I am adding SubViews to a vertical UIStackView with AddArrangedSubView. By default those views are positioned at the Left and Right edges.

I can set

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

And that will give me 15px of Left and Right Padding. That's great but what I really want is for the Left and Right padding to be controlled by the ReadableContentGuide. This works perfectly on a UITableView and the property is available on UIStackView however it has margins of 0.

How can I get a UILayoutGuide that has the right values for the current device and orientation?

Pat Long - Munkii Yebee
  • 3,592
  • 2
  • 34
  • 68

1 Answers1

0

it's a bug in UIStacView (width:200 , height 110 ) from log

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

when log UITextView (width:240 , height 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>;
Shehata Gamal
  • 98,760
  • 8
  • 65
  • 87