1

I need to archive a layout like this: layout

I tried using this guys answer to a similar question, but it didn't worked, I also tried to only set a view's height and a bg color, also didn't work - even though it displayed the line in the interface builder and preview mdoe.

I would like to create maybe a custom element, or just to draw a line, that could work with AutoLayout and be displayed at the interface builder.

Jonathan Solorzano
  • 6,812
  • 20
  • 70
  • 131

1 Answers1

0

You can use a horizontal UIStackView for this purpose. You should set it's alignment to be Center and it's distribution to be Fill. Then you can add a UIView, UILabel, UIView (in this order). Set both UIView to have equal width and height and give a height to one of them. In this way your UIStackView would be dynamic, in the sense that when the text in your UILabel gets bigger the "separators" on both sides would shrink. Don't know if that's what you want to achieve but it could be a possible solution!

Stefan Stefanov
  • 829
  • 7
  • 23