From 80bfeb0a4176e307a8b94b1662104e64cc8bb50c Mon Sep 17 00:00:00 2001 From: Laura Brown Date: Mon, 4 May 2015 13:41:55 -0400 Subject: [PATCH 1/3] 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/3] 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 From eb2329b700962bf603e26adc716f028f829f82b5 Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Tue, 12 Apr 2016 15:26:31 +0100 Subject: [PATCH 3/3] 2.0.2 --- .gitignore | 2 - CHANGELOG.md | 4 + Classes/ios/ORStackView.m | 6 +- ORStackView.podspec | 2 +- .../contents.xcworkspacedata | 10 ++ ORStackViewExample.xcodeproj/project.pbxproj | 122 +++++++++++++----- Podfile | 14 +- 7 files changed, 114 insertions(+), 46 deletions(-) create mode 100644 ORStackView.xcworkspace/contents.xcworkspacedata diff --git a/.gitignore b/.gitignore index cca3fd4..d1b12fa 100644 --- a/.gitignore +++ b/.gitignore @@ -15,8 +15,6 @@ profile DerivedData .idea/ *.hmap -ORStackView.xcworkspace - #CocoaPods Pods Podfile.lock diff --git a/CHANGELOG.md b/CHANGELOG.md index f5661e1..5bcc8eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # ORStackView CHANGELOG +## 2.0.2 + +* Supports Artsy's FLKAutoLayout v1 (heh) - @orta + ## 2.0.1 * Relaxes support for FLKAutoLayout, to allow using Artsy's FLKAutoLayout v1 - @orta diff --git a/Classes/ios/ORStackView.m b/Classes/ios/ORStackView.m index d95ff1f..c351894 100644 --- a/Classes/ios/ORStackView.m +++ b/Classes/ios/ORStackView.m @@ -67,12 +67,12 @@ - (void)updateConstraints [self addConstraints:constraints]; stackView.topConstraint = [constraints firstObject]; } else { - stackView.topConstraint = [[view alignTopEdgeWithView:self predicate:predicate] lastObject]; + stackView.topConstraint = [view alignTopEdgeWithView:self predicate:predicate]; } } else { UIView *viewAbove = [self.viewStack[index - 1] view]; - stackView.topConstraint = [[view constrainTopSpaceToView:viewAbove predicate:predicate] lastObject]; + stackView.topConstraint = [view constrainTopSpaceToView:viewAbove predicate:predicate]; } } @@ -81,7 +81,7 @@ - (void)updateConstraints UIView *lastView = self.lastView; if (self.lastView) { NSString *constraint = [NSString stringWithFormat:@"%0.0f", self.bottomMarginHeight]; - self.bottomConstraint = [[self alignBottomEdgeWithView:lastView predicate:constraint] lastObject]; + self.bottomConstraint = [self alignBottomEdgeWithView:lastView predicate:constraint]; } } diff --git a/ORStackView.podspec b/ORStackView.podspec index 61e1d59..6aa6b1d 100644 --- a/ORStackView.podspec +++ b/ORStackView.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ORStackView" - s.version = "2.0.1" + s.version = "2.0.3" s.summary = "An Auto Layout based Stack View." s.description = <<-DESC Vertically stack views using Auto Layout, also includes an diff --git a/ORStackView.xcworkspace/contents.xcworkspacedata b/ORStackView.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..795f900 --- /dev/null +++ b/ORStackView.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/ORStackViewExample.xcodeproj/project.pbxproj b/ORStackViewExample.xcodeproj/project.pbxproj index 9256e31..5c7b0b0 100644 --- a/ORStackViewExample.xcodeproj/project.pbxproj +++ b/ORStackViewExample.xcodeproj/project.pbxproj @@ -10,6 +10,30 @@ 46 objects + 0A20FC73BEE15F1FE484FF01 + + buildActionMask + 2147483647 + files + + inputPaths + + isa + PBXShellScriptBuildPhase + name + Embed Pods Frameworks + outputPaths + + runOnlyForDeploymentPostprocessing + 0 + shellPath + /bin/sh + shellScript + "${SRCROOT}/Pods/Target Support Files/Pods-ORStackViewExampleTests/Pods-ORStackViewExampleTests-frameworks.sh" + + showEnvVarsInLog + 0 + 0E1C1EA983E3B6656BCF96F7 includeInIndex @@ -25,33 +49,6 @@ sourceTree <group> - 14F0B294B6824B44B34168F0 - - fileRef - E9C7E6303EF0450AA7E90779 - isa - PBXBuildFile - - 17DCEB40252D42EEB1CAB58D - - explicitFileType - archive.ar - includeInIndex - 0 - isa - PBXFileReference - path - libPods-ORStackViewExample.a - sourceTree - BUILT_PRODUCTS_DIR - - 31567B196DCB44B98185C6CF - - fileRef - 17DCEB40252D42EEB1CAB58D - isa - PBXBuildFile - 31CC201EA22DCFC7AC9E7EC1 includeInIndex @@ -265,7 +262,7 @@ 2147483647 files - 14F0B294B6824B44B34168F0 + CD14D90B25924E977E1C57B7 isa PBXFrameworksBuildPhase @@ -294,6 +291,7 @@ 3CC74D70194245AC0069A97D 3CC74D71194245AC0069A97D D39064E21C4F40EE966CB43E + 0A20FC73BEE15F1FE484FF01 buildRules @@ -549,6 +547,13 @@ targetProxy 3CCBB58E1942489600559D85 + 44C301AAD4BC5B790C43486E + + fileRef + FF1B01DB3F50532C5E4249CF + isa + PBXBuildFile + 604D941B17BCD45900E331B1 children @@ -656,7 +661,7 @@ 3C9C9556194259DB00DEA440 3C9C9554194259D300DEA440 - 31567B196DCB44B98185C6CF + 44C301AAD4BC5B790C43486E isa PBXFrameworksBuildPhase @@ -689,6 +694,7 @@ 604D942117BCD45900E331B1 604D942217BCD45900E331B1 A7459F1A43CD44ECA12553B6 + 865156ED22D2804D7A6388C7 buildRules @@ -739,8 +745,8 @@ 3C9C955719425CB200DEA440 3C9C9555194259DB00DEA440 3C9C9553194259D300DEA440 - 17DCEB40252D42EEB1CAB58D - E9C7E6303EF0450AA7E90779 + FF1B01DB3F50532C5E4249CF + DF075E1ED1986B0C36C35BF6 isa PBXGroup @@ -1155,6 +1161,8 @@ ORStackViewExample/ORStackViewExample-Prefix.pch INFOPLIST_FILE ORStackViewExample/ORStackViewExample-Info.plist + IPHONEOS_DEPLOYMENT_TARGET + 8.0 PRODUCT_NAME ORStackViewExample TARGETED_DEVICE_FAMILY @@ -1188,6 +1196,8 @@ ORStackViewExample/ORStackViewExample-Prefix.pch INFOPLIST_FILE ORStackViewExample/ORStackViewExample-Info.plist + IPHONEOS_DEPLOYMENT_TARGET + 8.0 PRODUCT_NAME ORStackViewExample TARGETED_DEVICE_FAMILY @@ -1306,6 +1316,30 @@ sourceTree <group> + 865156ED22D2804D7A6388C7 + + buildActionMask + 2147483647 + files + + inputPaths + + isa + PBXShellScriptBuildPhase + name + Embed Pods Frameworks + outputPaths + + runOnlyForDeploymentPostprocessing + 0 + shellPath + /bin/sh + shellScript + "${SRCROOT}/Pods/Target Support Files/Pods-ORStackViewExample/Pods-ORStackViewExample-frameworks.sh" + + showEnvVarsInLog + 0 + 98D5E445BC3F662BE6BFD02C children @@ -1406,6 +1440,13 @@ fi showEnvVarsInLog 0 + CD14D90B25924E977E1C57B7 + + fileRef + DF075E1ED1986B0C36C35BF6 + isa + PBXBuildFile + D39064E21C4F40EE966CB43E buildActionMask @@ -1430,6 +1471,19 @@ fi showEnvVarsInLog 0 + DF075E1ED1986B0C36C35BF6 + + explicitFileType + wrapper.framework + includeInIndex + 0 + isa + PBXFileReference + path + Pods_ORStackViewExampleTests.framework + sourceTree + BUILT_PRODUCTS_DIR + E66861CD1922AB2F0017091C fileEncoding @@ -1526,16 +1580,16 @@ fi showEnvVarsInLog 0 - E9C7E6303EF0450AA7E90779 + FF1B01DB3F50532C5E4249CF explicitFileType - archive.ar + wrapper.framework includeInIndex 0 isa PBXFileReference path - libPods-ORStackViewExampleTests.a + Pods_ORStackViewExample.framework sourceTree BUILT_PRODUCTS_DIR diff --git a/Podfile b/Podfile index 185158b..4df288c 100644 --- a/Podfile +++ b/Podfile @@ -1,18 +1,20 @@ source 'https://github.com/CocoaPods/Specs.git' workspace 'ORStackView' +use_frameworks! + target 'ORStackViewExample' do pod "ORStackView", :path => "ORStackView.podspec" - pod 'FLKAutoLayout', '~> 0.1.1' + pod 'FLKAutoLayout', :git => 'https://github.com/orta/FLKAutoLayout.git', :branch => 'v1' xcodeproj 'ORStackViewExample.xcodeproj' end target 'ORStackViewExampleTests' do pod "ORStackView", :path => "ORStackView.podspec" - pod 'Specta', '0.2.1' - pod 'Expecta', '0.2.3' - pod 'OCMock', '2.2.4' - pod 'FBSnapshotTestCase', '1.2' - pod 'Expecta+Snapshots', '1.2.1' + pod 'Specta' + pod 'Expecta' + pod 'OCMock' + pod 'FBSnapshotTestCase' + pod 'Expecta+Snapshots' xcodeproj 'ORStackViewExample.xcodeproj' end