diff --git a/TZStackView/TZStackView.swift b/TZStackView/TZStackView.swift index 2fd77a8..7551c0b 100755 --- a/TZStackView/TZStackView.swift +++ b/TZStackView/TZStackView.swift @@ -31,11 +31,23 @@ public class TZStackView: UIView { } } - public var alignment: TZStackViewAlignment = .Fill + public var alignment: TZStackViewAlignment = .Fill { + didSet { + setNeedsUpdateConstraints() + } + } - public var spacing: CGFloat = 0 + public var spacing: CGFloat = 0 { + didSet { + setNeedsUpdateConstraints() + } + } - public var layoutMarginsRelativeArrangement = false + public var layoutMarginsRelativeArrangement = false { + didSet { + setNeedsUpdateConstraints() + } + } public private(set) var arrangedSubviews: [UIView] = [] { didSet { diff --git a/TZStackViewDemo/ViewController.swift b/TZStackViewDemo/ViewController.swift index 482cd17..6dcf6f2 100644 --- a/TZStackViewDemo/ViewController.swift +++ b/TZStackViewDemo/ViewController.swift @@ -159,7 +159,6 @@ class ViewController: UIViewController { default: tzStackView.alignment = .FirstBaseline } - tzStackView.setNeedsUpdateConstraints() } func distributionChanged(sender: UISegmentedControl) {