From 80bfeb0a4176e307a8b94b1662104e64cc8bb50c Mon Sep 17 00:00:00 2001 From: Laura Brown Date: Mon, 4 May 2015 13:41:55 -0400 Subject: [PATCH 1/2] ability to change the margin of subviews after setting it --- Classes/ios/ORStackView.h | 7 +++++++ Classes/ios/ORStackView.m | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/Classes/ios/ORStackView.h b/Classes/ios/ORStackView.h index eccc01c..c029c7b 100644 --- a/Classes/ios/ORStackView.h +++ b/Classes/ios/ORStackView.h @@ -50,15 +50,22 @@ /// Perform insertion / removals without updating the constraints - (void)performBatchUpdates:(void (^)(void))updates; +- (BOOL)updateTopMargin:(NSString *)topMargin forView:(UIView *)view; // Useful getters /// Returns the top constraint for a specific view - (NSLayoutConstraint *)topConstraintForView:(UIView *)view; +/// Returns the highest view in the stack. +- (UIView *)firstView; + /// Returns the lowest view in the stack. - (UIView *)lastView; +/// Force the top view to be flush with the top of the ORStackView +@property (nonatomic, assign) BOOL forceZeroTopMargin; + /// Setting this creates a bottom constraint letting the ORStackView set it's own height, defaults to 0, use NSNotFound to not create a bttom constraint. @property (nonatomic, assign) CGFloat bottomMarginHeight; diff --git a/Classes/ios/ORStackView.m b/Classes/ios/ORStackView.m index a9b45cc..d95ff1f 100644 --- a/Classes/ios/ORStackView.m +++ b/Classes/ios/ORStackView.m @@ -250,6 +250,24 @@ - (NSLayoutConstraint *)topConstraintForView:(UIView *)view return nil; } +- (BOOL)updateTopMargin:(NSString *)topMargin forView:(UIView *)view +{ + for (StackView *stackView in self.viewStack) { + if ([view isEqual:stackView.view]) { + stackView.constraintPredicate = topMargin; + if (!self.batchingUpdates) [self setNeedsUpdateConstraints]; + return YES; + } + } + + return NO; +} + +- (UIView *)firstView +{ + return [[self.viewStack firstObject] view]; +} + - (UIView *)lastView { return [[self.viewStack lastObject] view]; From bf49cc551b8fe8278e994be49c7c9d87d904f607 Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Tue, 12 Apr 2016 14:53:13 +0100 Subject: [PATCH 2/2] 2.0.1 --- CHANGELOG.md | 19 ++++++++++++++++++- ORStackView.podspec | 13 ++++++------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 107843e..f5661e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,26 @@ # ORStackView CHANGELOG +## 2.0.1 + +* Relaxes support for FLKAutoLayout, to allow using Artsy's FLKAutoLayout v1 - @orta +* Adds an API to edit top margins of existing views - 1aurabrown + +## 3.0.1 + +* iOS7 fixes - @garnett + +## 3.0.0 + +* Massive API breaking changes + +* Switched to use CGFloats instead of NSStrings - @garnett +* Supports horizontal layouts - @garnett +* Adds a ORStackViewController - @garnett + ## 2.0.0 * Fixed crash when setting ORStackView.bottomMarginHeight without any child views on iOS8 - @dblock -* Defaults to having a bottom constraint, I have _no idea_ why I didn't make this default. - @orta1 +* Defaults to having a bottom constraint, I have _no idea_ why I didn't make this default. - @orta * More inline documentation - @orta * Update FBSnapshotTestCase and Expecta+Snapshots to fix Xcode6 testing. - @dbgrandi * Support using Interface Builder - @orta diff --git a/ORStackView.podspec b/ORStackView.podspec index e6ecb08..61e1d59 100644 --- a/ORStackView.podspec +++ b/ORStackView.podspec @@ -1,23 +1,22 @@ Pod::Spec.new do |s| s.name = "ORStackView" - s.version = "2.0.0" + s.version = "2.0.1" s.summary = "An Auto Layout based Stack View." s.description = <<-DESC - Vertically stack views using Auto Layout, also includes an + Vertically stack views using Auto Layout, also includes an order specific subclass that uses view tags for ordering. DESC s.homepage = "https://github.com/orta/ORStackView" - + s.license = 'MIT' s.author = { "Orta Therox" => "orta.therox@gmail.com" } s.social_media_url = "http://twitter.com/orta" s.source = { :git => "https://github.com/orta/ORStackView.git", :tag => s.version.to_s } - s.platform = :ios, '6.0' - s.requires_arc = true + s.platform = :ios, '7.0' s.source_files = 'Classes/ios/*', 'Classes/ios/private/*' s.private_header_files = 'Classes/ios/private/*.h' - - s.dependency 'FLKAutoLayout', '~> 0.1' + + s.dependency 'FLKAutoLayout' end