Search code examples
cocoaautolayoutnsstackview

NSStackView edgeInsets gets ignored


Using edgeInsets on NSStackView is ignored by Interface Builder and when running the app.

NSStackView edgeInsets not working


Solution

  • NSStackView default hugging priority is 250. The edgeInsets is only enforced when the hugging priority is 500 or higher.

    NSStackView edgeInsets hugging priority

    Important: NSStackView has a hugging priority and a content hugging priority which are not the same.

    NSStackView hugging priority and a content hugging priority