From 3173d1adf3dbc0f58d0940aacb7ea4885d5c8fec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Cabe=C3=A7a?= Date: Mon, 20 Jul 2015 17:27:15 +0200 Subject: [PATCH] Added background view and margin related buttons. --- Example/OAStackView/Main.storyboard | 38 ++++++++++++++++++++++++-- Example/OAStackView/OAViewController.m | 17 ++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/Example/OAStackView/Main.storyboard b/Example/OAStackView/Main.storyboard index cf5c40e..8ad8d77 100644 --- a/Example/OAStackView/Main.storyboard +++ b/Example/OAStackView/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -18,6 +18,10 @@ + + + + @@ -52,7 +56,6 @@ - @@ -221,6 +224,33 @@ + + + @@ -266,11 +296,15 @@ + + + + diff --git a/Example/OAStackView/OAViewController.m b/Example/OAStackView/OAViewController.m index 35bc185..5f6e8d2 100644 --- a/Example/OAStackView/OAViewController.m +++ b/Example/OAStackView/OAViewController.m @@ -100,4 +100,21 @@ - (IBAction)distributionEqualCentering:(UIButton *)sender { self.stackView.distribution = OAStackViewDistributionEqualCentering; } +- (IBAction)marginsTapped:(UIButton *)sender { + switch (sender.tag) { + case 100: + self.stackView.layoutMarginsRelativeArrangement = YES; + self.stackView.layoutMargins = UIEdgeInsetsMake(10, 0, 10, 0); + break; + case 200: + self.stackView.layoutMarginsRelativeArrangement = YES; + self.stackView.layoutMargins = UIEdgeInsetsMake(10, 20, 30, 40); + break; + default: + self.stackView.layoutMarginsRelativeArrangement = NO; + self.stackView.layoutMargins = UIEdgeInsetsMake(0, 0, 0, 0); + break; + } +} + @end