• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
UIStackView full of labels doesn't add up
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

UIStackView full of labels doesn't add up


  • Subject: UIStackView full of labels doesn't add up
  • From: Roland King <email@hidden>
  • Date: Sun, 20 Mar 2016 20:57:22 +0800

I have a UIStackView, vertical, set to ‘fill equally’ with a number of UILabels in it. The stackview in this instance happens to be 300pts high. If I put 1 UILabel in it, the UILabel is 300pts high. This is what I would expect.

If I put two in it, the stackview sets them both 160pts high (total 320), three, they’re 113pts high (total 330) , four, 90pts high (total 360). None of those add up to 300 so the labels are not properly spaced out and don’t line up correctly with other groups of views which are next to them.

If I just put UIViews in the stackview it works as I’d expect, 2@150, 3@100, 4@75 .. etc and they fill in the way I would expect.

Is there an obvious reason why UIStackView ‘equally fills’ UILabels so the total height is more than the height of the stackview and they misalign themselves by a number of points?

I’m working around it by filling the stackview full of UIViews and then pinning a label inside each UIView, but that’s really sad.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: UIStackView full of labels doesn't add up
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: stop NSSearchField editing selected row in NSOutlineView
  • Next by Date: Re: stop NSSearchField editing selected row in NSOutlineView
  • Previous by thread: Re: stop NSSearchField editing selected row in NSOutlineView
  • Next by thread: Re: UIStackView full of labels doesn't add up
  • Index(es):
    • Date
    • Thread