layoutMargins explicit and layoutMarginsRelativeArrangement IB settings not respected

Originator:bruno
Number:rdar://21613035 Date Originated:30-Jun-2015 06:54 PM
Status:Closed Resolved:Since Xcode Version 7.1.1 (7B1005)
Product:iOS SDK Product Version:13A4280e
Classification:Enhancement Reproducible:Not Applicable
 
Update: 

Summary:
It appears the UIStackView does indeed respect the `layoutMargins` if you set `layoutMarginsRelativeArrangement = true`. However, it appears that setting these values explicitly in Interface Builder doesn't work. It does work when you set them in code. It would be great (and less confusing) if the IB settings are respected.

The IB settings are indicated in the screenshots.

Steps to reproduce:
1. Open attached .zip file.
2. Open attached xcode project through workspace.
3. Double-check IB setting for the UIStackView (see screenshots)
4. Run project.

Expected results:
* UIStackView looks as on the right of the attached example.png.
UIStackView layoutMargins: C.UIEdgeInsets(top: 20.0, left: 20.0, bottom: 20.0, right: 20.0) and layoutMarginsRelativeArrangement: true

Actual results:
* UIStackView looks as on the left of the attached example.png (margins not respected).
* Log states: "UIStackView layoutMargins: C.UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: 0.0) and layoutMarginsRelativeArrangement: false"

Notes:
You can uncomment line 20, 21 and 22 in ViewController.swift to set the values in code.
'nwaalertcontroller-update.zip' was successfully uploaded.
https://github.com/SpacyRicochet/NWAAlertController/commit/6d144579646ab919e88bd16cc18984cc6db28422

Previous:

Summary:
A common way to use UIStackView-like views (such as UIStackView) is to insert a number of arranged subviews, but keep a small amount of padding between the edges of the UIStackView and the arranged subviews. Like what the `layoutMargins` are supposed to achieve when you use constraints that respect them.

However, this is currently hard to achieve with a standard UIStackView without either nesting them over and over again, or creating a surplus of extra spacing views. This also makes UIStackViews which have padding harder to maintain.

A ‘padding’ variable would make life way easier when creating these kinds of views.

Steps to Reproduce:
n/a

Expected Results:
n/a

Actual Results:
n/a

Regression:
n/a

Notes:
n/a

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!