mfaani
mfaani

Reputation: 36287

pin subviews to leading and trailing edges of stackview

I have label1 and label2.

My stackview's axis is horizontal.

I want to pin label1 to the left and pin label2 to the far right. Similar to:

|label1-------------------label2| 

I know I can change label2's textAlignment to right but I was wondering if there is a pure stackview way of doing it (so I could use this for any other non-UILabel layouts)? I tried all kinds of distribution but non worked...

Upvotes: 0

Views: 1051

Answers (1)

mfaani
mfaani

Reputation: 36287

🙈

stackView.distribution = .equalSpacing

works just fine.

Not sure what I was doing wrong before...

Upvotes: 1

Related Questions