From fcd5a1e3cef99dfbe06b879bc4e06a7321547531 Mon Sep 17 00:00:00 2001 From: Mathias Amnell Date: Wed, 16 Jul 2014 12:37:26 +0200 Subject: [PATCH 1/6] Initial implementation of min-height and added fix for scrollbar offset --- .../UIScrollView+APParallaxHeader.m | 40 +- .../project.pbxproj | 1239 ++++++++++++----- .../APParallaxHeaderDemo-Prefix.pch | 2 + .../MasterViewController.m | 18 +- .../en.lproj/MainStoryboard.storyboard | 34 +- Demo/Podfile | 4 + Demo/Podfile.lock | 10 + .../UIImage+Additions/UIImage+Additions.h | 1 + .../UIImage+Additions/UIImage+Additions.h | 1 + Demo/Pods/Manifest.lock | 10 + .../Pods-UIImage+Additions-Private.xcconfig | 5 + Demo/Pods/Pods-UIImage+Additions-dummy.m | 5 + Demo/Pods/Pods-UIImage+Additions-prefix.pch | 5 + Demo/Pods/Pods-UIImage+Additions.xcconfig | 1 + Demo/Pods/Pods-acknowledgements.markdown | 13 + Demo/Pods/Pods-acknowledgements.plist | 43 + Demo/Pods/Pods-dummy.m | 5 + Demo/Pods/Pods-environment.h | 14 + Demo/Pods/Pods-resources.sh | 68 + Demo/Pods/Pods.xcconfig | 5 + Demo/Pods/Pods.xcodeproj/project.pbxproj | 983 +++++++++++++ Demo/Pods/UIImage+Additions/LICENSE.txt | 7 + Demo/Pods/UIImage+Additions/README.md | 81 ++ .../UIImage+Additions/UIImage+Additions.h | 139 ++ .../UIImage+Additions/UIImage+Additions.m | 601 ++++++++ 25 files changed, 2962 insertions(+), 372 deletions(-) create mode 100644 Demo/Podfile create mode 100644 Demo/Podfile.lock create mode 120000 Demo/Pods/BuildHeaders/UIImage+Additions/UIImage+Additions.h create mode 120000 Demo/Pods/Headers/UIImage+Additions/UIImage+Additions.h create mode 100644 Demo/Pods/Manifest.lock create mode 100644 Demo/Pods/Pods-UIImage+Additions-Private.xcconfig create mode 100644 Demo/Pods/Pods-UIImage+Additions-dummy.m create mode 100644 Demo/Pods/Pods-UIImage+Additions-prefix.pch create mode 100644 Demo/Pods/Pods-UIImage+Additions.xcconfig create mode 100644 Demo/Pods/Pods-acknowledgements.markdown create mode 100644 Demo/Pods/Pods-acknowledgements.plist create mode 100644 Demo/Pods/Pods-dummy.m create mode 100644 Demo/Pods/Pods-environment.h create mode 100755 Demo/Pods/Pods-resources.sh create mode 100644 Demo/Pods/Pods.xcconfig create mode 100644 Demo/Pods/Pods.xcodeproj/project.pbxproj create mode 100644 Demo/Pods/UIImage+Additions/LICENSE.txt create mode 100644 Demo/Pods/UIImage+Additions/README.md create mode 100644 Demo/Pods/UIImage+Additions/UIImage+Additions.h create mode 100644 Demo/Pods/UIImage+Additions/UIImage+Additions.m diff --git a/APParallaxHeader/UIScrollView+APParallaxHeader.m b/APParallaxHeader/UIScrollView+APParallaxHeader.m index 1ae089b..b6ac19d 100755 --- a/APParallaxHeader/UIScrollView+APParallaxHeader.m +++ b/APParallaxHeader/UIScrollView+APParallaxHeader.m @@ -21,8 +21,6 @@ @interface APParallaxView () @end - - #pragma mark - UIScrollView (APParallaxHeader) #import @@ -117,6 +115,10 @@ - (BOOL)showsParallax { return !self.parallaxView.hidden; } +- (void)didMoveToSuperview { + [super didMoveToSuperview]; +} + @end #pragma mark - ShadowLayer @@ -203,8 +205,7 @@ - (void)willMoveToSuperview:(UIView *)newSuperview { } } -- (void)addSubview:(UIView *)view -{ +- (void)addSubview:(UIView *)view { [super addSubview:view]; self.currentSubView = view; } @@ -212,24 +213,35 @@ - (void)addSubview:(UIView *)view #pragma mark - Observing - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - if([keyPath isEqualToString:@"contentOffset"]) + if([keyPath isEqualToString:@"contentOffset"]) { [self scrollViewDidScroll:[[change valueForKey:NSKeyValueChangeNewKey] CGPointValue]]; - else if([keyPath isEqualToString:@"frame"]) + } + else if([keyPath isEqualToString:@"frame"]) { [self layoutSubviews]; + } } +#define MIN_HEIGHT 64 + - (void)scrollViewDidScroll:(CGPoint)contentOffset { - // We do not want to track when the parallax view is hidden - if (contentOffset.y > 0) { - [self setState:APParallaxTrackingInactive]; - } else { - [self setState:APParallaxTrackingActive]; + // Resize/reposition the parallaxView based on the content offset + CGFloat yOffset = contentOffset.y*-1; + if (yOffset <= MIN_HEIGHT) { + CGRect rect = self.frame; + rect.origin.y = contentOffset.y; + rect.size.height = MAX(MIN_HEIGHT, yOffset); + self.frame = rect; } - - if(self.state == APParallaxTrackingActive) { - CGFloat yOffset = contentOffset.y*-1; + else { [self setFrame:CGRectMake(0, contentOffset.y, CGRectGetWidth(self.frame), yOffset)]; } + + // Correct the scroll indicator position + if (self.scrollView.contentOffset.y < -self.parallaxHeight) { + [self.scrollView setScrollIndicatorInsets:UIEdgeInsetsMake(self.scrollView.contentInset.top+(abs(self.scrollView.contentOffset.y)-self.parallaxHeight), 0, 0, 0)]; + } else { + [self.scrollView setScrollIndicatorInsets:UIEdgeInsetsMake(self.scrollView.contentInset.top, 0, 0, 0)]; + } } @end diff --git a/Demo/APParallaxHeaderDemo.xcodeproj/project.pbxproj b/Demo/APParallaxHeaderDemo.xcodeproj/project.pbxproj index 0a98333..4aa8bfe 100644 --- a/Demo/APParallaxHeaderDemo.xcodeproj/project.pbxproj +++ b/Demo/APParallaxHeaderDemo.xcodeproj/project.pbxproj @@ -1,335 +1,904 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 113BBD0A171B0A3800BC6574 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 113BBD09171B0A3800BC6574 /* QuartzCore.framework */; }; - A697F31F17A02B5F003B821D /* Rover.jpg in Resources */ = {isa = PBXBuildFile; fileRef = A697F31E17A02B5F003B821D /* Rover.jpg */; }; - C72B531F171834E60093E24F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C72B531E171834E60093E24F /* UIKit.framework */; }; - C72B5321171834E60093E24F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C72B5320171834E60093E24F /* Foundation.framework */; }; - C72B5323171834E60093E24F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C72B5322171834E60093E24F /* CoreGraphics.framework */; }; - C72B5329171834E60093E24F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = C72B5327171834E60093E24F /* InfoPlist.strings */; }; - C72B532B171834E60093E24F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C72B532A171834E60093E24F /* main.m */; }; - C72B532F171834E60093E24F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C72B532E171834E60093E24F /* AppDelegate.m */; }; - C72B5331171834E60093E24F /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = C72B5330171834E60093E24F /* Default.png */; }; - C72B5333171834E60093E24F /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C72B5332171834E60093E24F /* Default@2x.png */; }; - C72B5335171834E60093E24F /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C72B5334171834E60093E24F /* Default-568h@2x.png */; }; - C72B5338171834E60093E24F /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C72B5336171834E60093E24F /* MainStoryboard.storyboard */; }; - C72B533B171834E60093E24F /* MasterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C72B533A171834E60093E24F /* MasterViewController.m */; }; - C7E3C5FF17183E4500489EE2 /* ParallaxImage.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C7E3C5FE17183E4500489EE2 /* ParallaxImage.jpg */; }; - C7E3C605171842CA00489EE2 /* UIScrollView+APParallaxHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = C7E3C604171842CA00489EE2 /* UIScrollView+APParallaxHeader.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 113BBD09171B0A3800BC6574 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - A697F31E17A02B5F003B821D /* Rover.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Rover.jpg; sourceTree = ""; }; - C72B531B171834E60093E24F /* APParallaxHeaderDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = APParallaxHeaderDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; - C72B531E171834E60093E24F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - C72B5320171834E60093E24F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - C72B5322171834E60093E24F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - C72B5326171834E60093E24F /* APParallaxHeaderDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "APParallaxHeaderDemo-Info.plist"; sourceTree = ""; }; - C72B5328171834E60093E24F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - C72B532A171834E60093E24F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - C72B532C171834E60093E24F /* APParallaxHeaderDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "APParallaxHeaderDemo-Prefix.pch"; sourceTree = ""; }; - C72B532D171834E60093E24F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - C72B532E171834E60093E24F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - C72B5330171834E60093E24F /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; - C72B5332171834E60093E24F /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; - C72B5334171834E60093E24F /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; - C72B5337171834E60093E24F /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard.storyboard; sourceTree = ""; }; - C72B5339171834E60093E24F /* MasterViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MasterViewController.h; sourceTree = ""; }; - C72B533A171834E60093E24F /* MasterViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MasterViewController.m; sourceTree = ""; }; - C7E3C5FE17183E4500489EE2 /* ParallaxImage.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = ParallaxImage.jpg; sourceTree = ""; }; - C7E3C603171842CA00489EE2 /* UIScrollView+APParallaxHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+APParallaxHeader.h"; sourceTree = ""; }; - C7E3C604171842CA00489EE2 /* UIScrollView+APParallaxHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+APParallaxHeader.m"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - C72B5318171834E60093E24F /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 113BBD0A171B0A3800BC6574 /* QuartzCore.framework in Frameworks */, - C72B531F171834E60093E24F /* UIKit.framework in Frameworks */, - C72B5321171834E60093E24F /* Foundation.framework in Frameworks */, - C72B5323171834E60093E24F /* CoreGraphics.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - C72B5312171834E60093E24F = { - isa = PBXGroup; - children = ( - C7E3C602171842CA00489EE2 /* APParallaxHeader */, - C72B5324171834E60093E24F /* APParallaxHeaderDemo */, - C72B531D171834E60093E24F /* Frameworks */, - C72B531C171834E60093E24F /* Products */, - ); - sourceTree = ""; - }; - C72B531C171834E60093E24F /* Products */ = { - isa = PBXGroup; - children = ( - C72B531B171834E60093E24F /* APParallaxHeaderDemo.app */, - ); - name = Products; - sourceTree = ""; - }; - C72B531D171834E60093E24F /* Frameworks */ = { - isa = PBXGroup; - children = ( - 113BBD09171B0A3800BC6574 /* QuartzCore.framework */, - C72B531E171834E60093E24F /* UIKit.framework */, - C72B5320171834E60093E24F /* Foundation.framework */, - C72B5322171834E60093E24F /* CoreGraphics.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - C72B5324171834E60093E24F /* APParallaxHeaderDemo */ = { - isa = PBXGroup; - children = ( - C72B532D171834E60093E24F /* AppDelegate.h */, - C72B532E171834E60093E24F /* AppDelegate.m */, - C72B5336171834E60093E24F /* MainStoryboard.storyboard */, - C72B5339171834E60093E24F /* MasterViewController.h */, - C72B533A171834E60093E24F /* MasterViewController.m */, - C72B5325171834E60093E24F /* Supporting Files */, - ); - path = APParallaxHeaderDemo; - sourceTree = ""; - }; - C72B5325171834E60093E24F /* Supporting Files */ = { - isa = PBXGroup; - children = ( - A697F31E17A02B5F003B821D /* Rover.jpg */, - C7E3C5FE17183E4500489EE2 /* ParallaxImage.jpg */, - C72B5326171834E60093E24F /* APParallaxHeaderDemo-Info.plist */, - C72B5327171834E60093E24F /* InfoPlist.strings */, - C72B532A171834E60093E24F /* main.m */, - C72B532C171834E60093E24F /* APParallaxHeaderDemo-Prefix.pch */, - C72B5330171834E60093E24F /* Default.png */, - C72B5332171834E60093E24F /* Default@2x.png */, - C72B5334171834E60093E24F /* Default-568h@2x.png */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - C7E3C602171842CA00489EE2 /* APParallaxHeader */ = { - isa = PBXGroup; - children = ( - C7E3C603171842CA00489EE2 /* UIScrollView+APParallaxHeader.h */, - C7E3C604171842CA00489EE2 /* UIScrollView+APParallaxHeader.m */, - ); - name = APParallaxHeader; - path = ../APParallaxHeader; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - C72B531A171834E60093E24F /* APParallaxHeaderDemo */ = { - isa = PBXNativeTarget; - buildConfigurationList = C72B5341171834E60093E24F /* Build configuration list for PBXNativeTarget "APParallaxHeaderDemo" */; - buildPhases = ( - C72B5317171834E60093E24F /* Sources */, - C72B5318171834E60093E24F /* Frameworks */, - C72B5319171834E60093E24F /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = APParallaxHeaderDemo; - productName = APParallaxHeaderDemo; - productReference = C72B531B171834E60093E24F /* APParallaxHeaderDemo.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - C72B5313171834E60093E24F /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0460; - ORGANIZATIONNAME = "Apping AB"; - }; - buildConfigurationList = C72B5316171834E60093E24F /* Build configuration list for PBXProject "APParallaxHeaderDemo" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = C72B5312171834E60093E24F; - productRefGroup = C72B531C171834E60093E24F /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - C72B531A171834E60093E24F /* APParallaxHeaderDemo */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - C72B5319171834E60093E24F /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - C72B5329171834E60093E24F /* InfoPlist.strings in Resources */, - C72B5331171834E60093E24F /* Default.png in Resources */, - C72B5333171834E60093E24F /* Default@2x.png in Resources */, - C72B5335171834E60093E24F /* Default-568h@2x.png in Resources */, - C72B5338171834E60093E24F /* MainStoryboard.storyboard in Resources */, - C7E3C5FF17183E4500489EE2 /* ParallaxImage.jpg in Resources */, - A697F31F17A02B5F003B821D /* Rover.jpg in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - C72B5317171834E60093E24F /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - C72B532B171834E60093E24F /* main.m in Sources */, - C72B532F171834E60093E24F /* AppDelegate.m in Sources */, - C72B533B171834E60093E24F /* MasterViewController.m in Sources */, - C7E3C605171842CA00489EE2 /* UIScrollView+APParallaxHeader.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - C72B5327171834E60093E24F /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - C72B5328171834E60093E24F /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - C72B5336171834E60093E24F /* MainStoryboard.storyboard */ = { - isa = PBXVariantGroup; - children = ( - C72B5337171834E60093E24F /* en */, - ); - name = MainStoryboard.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - C72B533F171834E60093E24F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - C72B5340171834E60093E24F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; - OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - C72B5342171834E60093E24F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch"; - INFOPLIST_FILE = "APParallaxHeaderDemo/APParallaxHeaderDemo-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Debug; - }; - C72B5343171834E60093E24F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch"; - INFOPLIST_FILE = "APParallaxHeaderDemo/APParallaxHeaderDemo-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - C72B5316171834E60093E24F /* Build configuration list for PBXProject "APParallaxHeaderDemo" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C72B533F171834E60093E24F /* Debug */, - C72B5340171834E60093E24F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C72B5341171834E60093E24F /* Build configuration list for PBXNativeTarget "APParallaxHeaderDemo" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C72B5342171834E60093E24F /* Debug */, - C72B5343171834E60093E24F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = C72B5313171834E60093E24F /* Project object */; -} + + + + + archiveVersion + 1 + classes + + objectVersion + 46 + objects + + 113BBD09171B0A3800BC6574 + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + QuartzCore.framework + path + System/Library/Frameworks/QuartzCore.framework + sourceTree + SDKROOT + + 113BBD0A171B0A3800BC6574 + + fileRef + 113BBD09171B0A3800BC6574 + isa + PBXBuildFile + + 1487D1CF542146F8B5FBD373 + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods.a + sourceTree + BUILT_PRODUCTS_DIR + + 33C7148EE9E84A53A509D6DB + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + name + Pods.xcconfig + path + Pods/Pods.xcconfig + sourceTree + <group> + + 568854A15E5F4916BDBE8BB9 + + buildActionMask + 2147483647 + files + + inputPaths + + isa + PBXShellScriptBuildPhase + name + Copy Pods Resources + outputPaths + + runOnlyForDeploymentPostprocessing + 0 + shellPath + /bin/sh + shellScript + "${SRCROOT}/Pods/Pods-resources.sh" + + showEnvVarsInLog + 0 + + A697F31E17A02B5F003B821D + + isa + PBXFileReference + lastKnownFileType + image.jpeg + path + Rover.jpg + sourceTree + <group> + + A697F31F17A02B5F003B821D + + fileRef + A697F31E17A02B5F003B821D + isa + PBXBuildFile + + B0447B6A324D4235B356036E + + fileRef + 1487D1CF542146F8B5FBD373 + isa + PBXBuildFile + + C72B5312171834E60093E24F + + children + + C7E3C602171842CA00489EE2 + C72B5324171834E60093E24F + C72B531D171834E60093E24F + C72B531C171834E60093E24F + 33C7148EE9E84A53A509D6DB + + isa + PBXGroup + sourceTree + <group> + + C72B5313171834E60093E24F + + attributes + + LastUpgradeCheck + 0460 + ORGANIZATIONNAME + Apping AB + TargetAttributes + + C72B531A171834E60093E24F + + DevelopmentTeam + V98K4C44UG + + + + buildConfigurationList + C72B5316171834E60093E24F + compatibilityVersion + Xcode 3.2 + developmentRegion + English + hasScannedForEncodings + 0 + isa + PBXProject + knownRegions + + en + + mainGroup + C72B5312171834E60093E24F + productRefGroup + C72B531C171834E60093E24F + projectDirPath + + projectReferences + + projectRoot + + targets + + C72B531A171834E60093E24F + + + C72B5316171834E60093E24F + + buildConfigurations + + C72B533F171834E60093E24F + C72B5340171834E60093E24F + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + C72B5317171834E60093E24F + + buildActionMask + 2147483647 + files + + C72B532B171834E60093E24F + C72B532F171834E60093E24F + C72B533B171834E60093E24F + C7E3C605171842CA00489EE2 + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + C72B5318171834E60093E24F + + buildActionMask + 2147483647 + files + + 113BBD0A171B0A3800BC6574 + C72B531F171834E60093E24F + C72B5321171834E60093E24F + C72B5323171834E60093E24F + B0447B6A324D4235B356036E + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + C72B5319171834E60093E24F + + buildActionMask + 2147483647 + files + + C72B5329171834E60093E24F + C72B5331171834E60093E24F + C72B5333171834E60093E24F + C72B5335171834E60093E24F + C72B5338171834E60093E24F + C7E3C5FF17183E4500489EE2 + A697F31F17A02B5F003B821D + + isa + PBXResourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + C72B531A171834E60093E24F + + buildConfigurationList + C72B5341171834E60093E24F + buildPhases + + EC203B1DF10846C5936DC33A + C72B5317171834E60093E24F + C72B5318171834E60093E24F + C72B5319171834E60093E24F + 568854A15E5F4916BDBE8BB9 + + buildRules + + dependencies + + isa + PBXNativeTarget + name + APParallaxHeaderDemo + productName + APParallaxHeaderDemo + productReference + C72B531B171834E60093E24F + productType + com.apple.product-type.application + + C72B531B171834E60093E24F + + explicitFileType + wrapper.application + includeInIndex + 0 + isa + PBXFileReference + path + APParallaxHeaderDemo.app + sourceTree + BUILT_PRODUCTS_DIR + + C72B531C171834E60093E24F + + children + + C72B531B171834E60093E24F + + isa + PBXGroup + name + Products + sourceTree + <group> + + C72B531D171834E60093E24F + + children + + 113BBD09171B0A3800BC6574 + C72B531E171834E60093E24F + C72B5320171834E60093E24F + C72B5322171834E60093E24F + 1487D1CF542146F8B5FBD373 + + isa + PBXGroup + name + Frameworks + sourceTree + <group> + + C72B531E171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + UIKit.framework + path + System/Library/Frameworks/UIKit.framework + sourceTree + SDKROOT + + C72B531F171834E60093E24F + + fileRef + C72B531E171834E60093E24F + isa + PBXBuildFile + + C72B5320171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + Foundation.framework + path + System/Library/Frameworks/Foundation.framework + sourceTree + SDKROOT + + C72B5321171834E60093E24F + + fileRef + C72B5320171834E60093E24F + isa + PBXBuildFile + + C72B5322171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + CoreGraphics.framework + path + System/Library/Frameworks/CoreGraphics.framework + sourceTree + SDKROOT + + C72B5323171834E60093E24F + + fileRef + C72B5322171834E60093E24F + isa + PBXBuildFile + + C72B5324171834E60093E24F + + children + + C72B532D171834E60093E24F + C72B532E171834E60093E24F + C72B5336171834E60093E24F + C72B5339171834E60093E24F + C72B533A171834E60093E24F + C72B5325171834E60093E24F + + isa + PBXGroup + path + APParallaxHeaderDemo + sourceTree + <group> + + C72B5325171834E60093E24F + + children + + A697F31E17A02B5F003B821D + C7E3C5FE17183E4500489EE2 + C72B5326171834E60093E24F + C72B5327171834E60093E24F + C72B532A171834E60093E24F + C72B532C171834E60093E24F + C72B5330171834E60093E24F + C72B5332171834E60093E24F + C72B5334171834E60093E24F + + isa + PBXGroup + name + Supporting Files + sourceTree + <group> + + C72B5326171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + text.plist.xml + path + APParallaxHeaderDemo-Info.plist + sourceTree + <group> + + C72B5327171834E60093E24F + + children + + C72B5328171834E60093E24F + + isa + PBXVariantGroup + name + InfoPlist.strings + sourceTree + <group> + + C72B5328171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + text.plist.strings + name + en + path + en.lproj/InfoPlist.strings + sourceTree + <group> + + C72B5329171834E60093E24F + + fileRef + C72B5327171834E60093E24F + isa + PBXBuildFile + + C72B532A171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + main.m + sourceTree + <group> + + C72B532B171834E60093E24F + + fileRef + C72B532A171834E60093E24F + isa + PBXBuildFile + + C72B532C171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + APParallaxHeaderDemo-Prefix.pch + sourceTree + <group> + + C72B532D171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + AppDelegate.h + sourceTree + <group> + + C72B532E171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + AppDelegate.m + sourceTree + <group> + + C72B532F171834E60093E24F + + fileRef + C72B532E171834E60093E24F + isa + PBXBuildFile + + C72B5330171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + image.png + path + Default.png + sourceTree + <group> + + C72B5331171834E60093E24F + + fileRef + C72B5330171834E60093E24F + isa + PBXBuildFile + + C72B5332171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + image.png + path + Default@2x.png + sourceTree + <group> + + C72B5333171834E60093E24F + + fileRef + C72B5332171834E60093E24F + isa + PBXBuildFile + + C72B5334171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + image.png + path + Default-568h@2x.png + sourceTree + <group> + + C72B5335171834E60093E24F + + fileRef + C72B5334171834E60093E24F + isa + PBXBuildFile + + C72B5336171834E60093E24F + + children + + C72B5337171834E60093E24F + + isa + PBXVariantGroup + name + MainStoryboard.storyboard + sourceTree + <group> + + C72B5337171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + file.storyboard + name + en + path + en.lproj/MainStoryboard.storyboard + sourceTree + <group> + + C72B5338171834E60093E24F + + fileRef + C72B5336171834E60093E24F + isa + PBXBuildFile + + C72B5339171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + MasterViewController.h + sourceTree + <group> + + C72B533A171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + MasterViewController.m + sourceTree + <group> + + C72B533B171834E60093E24F + + fileRef + C72B533A171834E60093E24F + isa + PBXBuildFile + + C72B533F171834E60093E24F + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_OBJC_ARC + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN__DUPLICATE_METHOD_MATCH + YES + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + COPY_PHASE_STRIP + NO + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + GCC_WARN_ABOUT_RETURN_TYPE + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 6.1 + ONLY_ACTIVE_ARCH + YES + SDKROOT + iphoneos + + isa + XCBuildConfiguration + name + Debug + + C72B5340171834E60093E24F + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_OBJC_ARC + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN__DUPLICATE_METHOD_MATCH + YES + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + COPY_PHASE_STRIP + YES + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_WARN_ABOUT_RETURN_TYPE + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 6.1 + OTHER_CFLAGS + -DNS_BLOCK_ASSERTIONS=1 + SDKROOT + iphoneos + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + C72B5341171834E60093E24F + + buildConfigurations + + C72B5342171834E60093E24F + C72B5343171834E60093E24F + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + C72B5342171834E60093E24F + + baseConfigurationReference + 33C7148EE9E84A53A509D6DB + buildSettings + + CODE_SIGN_IDENTITY + iPhone Developer + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch + INFOPLIST_FILE + APParallaxHeaderDemo/APParallaxHeaderDemo-Info.plist + IPHONEOS_DEPLOYMENT_TARGET + 6.1 + PRODUCT_NAME + $(TARGET_NAME) + PROVISIONING_PROFILE + + WRAPPER_EXTENSION + app + + isa + XCBuildConfiguration + name + Debug + + C72B5343171834E60093E24F + + baseConfigurationReference + 33C7148EE9E84A53A509D6DB + buildSettings + + CODE_SIGN_IDENTITY + iPhone Developer + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch + INFOPLIST_FILE + APParallaxHeaderDemo/APParallaxHeaderDemo-Info.plist + IPHONEOS_DEPLOYMENT_TARGET + 6.1 + PRODUCT_NAME + $(TARGET_NAME) + PROVISIONING_PROFILE + + WRAPPER_EXTENSION + app + + isa + XCBuildConfiguration + name + Release + + C7E3C5FE17183E4500489EE2 + + isa + PBXFileReference + lastKnownFileType + image.jpeg + path + ParallaxImage.jpg + sourceTree + <group> + + C7E3C5FF17183E4500489EE2 + + fileRef + C7E3C5FE17183E4500489EE2 + isa + PBXBuildFile + + C7E3C602171842CA00489EE2 + + children + + C7E3C603171842CA00489EE2 + C7E3C604171842CA00489EE2 + + isa + PBXGroup + name + APParallaxHeader + path + ../APParallaxHeader + sourceTree + <group> + + C7E3C603171842CA00489EE2 + + fileEncoding + 4 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + UIScrollView+APParallaxHeader.h + sourceTree + <group> + + C7E3C604171842CA00489EE2 + + fileEncoding + 4 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + UIScrollView+APParallaxHeader.m + sourceTree + <group> + + C7E3C605171842CA00489EE2 + + fileRef + C7E3C604171842CA00489EE2 + isa + PBXBuildFile + + EC203B1DF10846C5936DC33A + + buildActionMask + 2147483647 + files + + inputPaths + + isa + PBXShellScriptBuildPhase + name + Check Pods Manifest.lock + outputPaths + + runOnlyForDeploymentPostprocessing + 0 + shellPath + /bin/sh + shellScript + diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null +if [[ $? != 0 ]] ; then + cat << EOM +error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation. +EOM + exit 1 +fi + + showEnvVarsInLog + 0 + + + rootObject + C72B5313171834E60093E24F + + diff --git a/Demo/APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch b/Demo/APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch index 41ecb3c..8e93001 100644 --- a/Demo/APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch +++ b/Demo/APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch @@ -11,4 +11,6 @@ #ifdef __OBJC__ #import #import + +#import #endif diff --git a/Demo/APParallaxHeaderDemo/MasterViewController.m b/Demo/APParallaxHeaderDemo/MasterViewController.m index 6b0a968..9c80fc1 100644 --- a/Demo/APParallaxHeaderDemo/MasterViewController.m +++ b/Demo/APParallaxHeaderDemo/MasterViewController.m @@ -9,6 +9,8 @@ #import "MasterViewController.h" #import "UIScrollView+APParallaxHeader.h" +#define PARALLAX_HEIGHT 320 + @interface MasterViewController () { BOOL parallaxWithView; @@ -23,6 +25,11 @@ - (void)viewDidLoad UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithTitle:@"with view" style:UIBarButtonItemStylePlain target:self action:@selector(toggle:)]; [self.navigationItem setRightBarButtonItem:barButton]; + + [self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor] size:CGSizeMake(200, 200)] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault]; + [self.navigationController.navigationBar setShadowImage:[UIImage new]]; + + self.automaticallyAdjustsScrollViewInsets = NO; [self toggle:nil]; } @@ -33,9 +40,9 @@ - (void)toggle:(id)sender { // add parallax with view UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Rover.jpg"]]; - [imageView setFrame:CGRectMake(0, 0, 320, 160)]; + [imageView setFrame:CGRectMake(0, 0, 320, PARALLAX_HEIGHT)]; [imageView setContentMode:UIViewContentModeScaleAspectFill]; - [self.tableView addParallaxWithView:imageView andHeight:160]; + [self.tableView addParallaxWithView:imageView andHeight:PARALLAX_HEIGHT]; parallaxWithView = YES; UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithTitle:@"with image" style:UIBarButtonItemStylePlain target:self action:@selector(toggle:)]; @@ -44,7 +51,7 @@ - (void)toggle:(id)sender else { // add parallax with image - [self.tableView addParallaxWithImage:[UIImage imageNamed:@"ParallaxImage.jpg"] andHeight:160]; + [self.tableView addParallaxWithImage:[UIImage imageNamed:@"ParallaxImage.jpg"] andHeight:PARALLAX_HEIGHT]; parallaxWithView = NO; UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithTitle:@"with view" style:UIBarButtonItemStylePlain target:self action:@selector(toggle:)]; @@ -54,8 +61,7 @@ - (void)toggle:(id)sender #pragma mark - Table View -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView -{ +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } @@ -68,7 +74,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; - cell.textLabel.text = [NSString stringWithFormat:@"Row %i", indexPath.row+1]; + cell.textLabel.text = [NSString stringWithFormat:@"Row %li", indexPath.row+1]; return cell; } diff --git a/Demo/APParallaxHeaderDemo/en.lproj/MainStoryboard.storyboard b/Demo/APParallaxHeaderDemo/en.lproj/MainStoryboard.storyboard index e2cdc06..395d1c6 100644 --- a/Demo/APParallaxHeaderDemo/en.lproj/MainStoryboard.storyboard +++ b/Demo/APParallaxHeaderDemo/en.lproj/MainStoryboard.storyboard @@ -1,7 +1,9 @@ - + - + + + @@ -20,19 +22,19 @@ - + - - - + + + - + - + @@ -44,8 +46,7 @@ - - + @@ -55,6 +56,7 @@ + @@ -62,14 +64,12 @@ - - - - - - + + + + - \ No newline at end of file + diff --git a/Demo/Podfile b/Demo/Podfile new file mode 100644 index 0000000..d22df99 --- /dev/null +++ b/Demo/Podfile @@ -0,0 +1,4 @@ +# Uncomment this line to define a global platform for your project +platform :ios, "7.0" + +pod 'UIImage+Additions' diff --git a/Demo/Podfile.lock b/Demo/Podfile.lock new file mode 100644 index 0000000..096e562 --- /dev/null +++ b/Demo/Podfile.lock @@ -0,0 +1,10 @@ +PODS: + - UIImage+Additions (1.1.0) + +DEPENDENCIES: + - UIImage+Additions + +SPEC CHECKSUMS: + UIImage+Additions: 66ee88773215955a2703ea31b790fdf3438303d9 + +COCOAPODS: 0.33.1 diff --git a/Demo/Pods/BuildHeaders/UIImage+Additions/UIImage+Additions.h b/Demo/Pods/BuildHeaders/UIImage+Additions/UIImage+Additions.h new file mode 120000 index 0000000..091c642 --- /dev/null +++ b/Demo/Pods/BuildHeaders/UIImage+Additions/UIImage+Additions.h @@ -0,0 +1 @@ +../../UIImage+Additions/UIImage+Additions.h \ No newline at end of file diff --git a/Demo/Pods/Headers/UIImage+Additions/UIImage+Additions.h b/Demo/Pods/Headers/UIImage+Additions/UIImage+Additions.h new file mode 120000 index 0000000..091c642 --- /dev/null +++ b/Demo/Pods/Headers/UIImage+Additions/UIImage+Additions.h @@ -0,0 +1 @@ +../../UIImage+Additions/UIImage+Additions.h \ No newline at end of file diff --git a/Demo/Pods/Manifest.lock b/Demo/Pods/Manifest.lock new file mode 100644 index 0000000..096e562 --- /dev/null +++ b/Demo/Pods/Manifest.lock @@ -0,0 +1,10 @@ +PODS: + - UIImage+Additions (1.1.0) + +DEPENDENCIES: + - UIImage+Additions + +SPEC CHECKSUMS: + UIImage+Additions: 66ee88773215955a2703ea31b790fdf3438303d9 + +COCOAPODS: 0.33.1 diff --git a/Demo/Pods/Pods-UIImage+Additions-Private.xcconfig b/Demo/Pods/Pods-UIImage+Additions-Private.xcconfig new file mode 100644 index 0000000..d8c98bb --- /dev/null +++ b/Demo/Pods/Pods-UIImage+Additions-Private.xcconfig @@ -0,0 +1,5 @@ +#include "Pods-UIImage+Additions.xcconfig" +GCC_PREPROCESSOR_DEFINITIONS = COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/UIImage+Additions" "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/UIImage+Additions" +OTHER_LDFLAGS = -ObjC ${PODS_UIIMAGE_ADDITIONS_OTHER_LDFLAGS} +PODS_ROOT = ${SRCROOT} \ No newline at end of file diff --git a/Demo/Pods/Pods-UIImage+Additions-dummy.m b/Demo/Pods/Pods-UIImage+Additions-dummy.m new file mode 100644 index 0000000..0a41f0d --- /dev/null +++ b/Demo/Pods/Pods-UIImage+Additions-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_UIImage_Additions : NSObject +@end +@implementation PodsDummy_Pods_UIImage_Additions +@end diff --git a/Demo/Pods/Pods-UIImage+Additions-prefix.pch b/Demo/Pods/Pods-UIImage+Additions-prefix.pch new file mode 100644 index 0000000..95cf11d --- /dev/null +++ b/Demo/Pods/Pods-UIImage+Additions-prefix.pch @@ -0,0 +1,5 @@ +#ifdef __OBJC__ +#import +#endif + +#import "Pods-environment.h" diff --git a/Demo/Pods/Pods-UIImage+Additions.xcconfig b/Demo/Pods/Pods-UIImage+Additions.xcconfig new file mode 100644 index 0000000..3a05cad --- /dev/null +++ b/Demo/Pods/Pods-UIImage+Additions.xcconfig @@ -0,0 +1 @@ +PODS_UIIMAGE_ADDITIONS_OTHER_LDFLAGS = -framework UIKit \ No newline at end of file diff --git a/Demo/Pods/Pods-acknowledgements.markdown b/Demo/Pods/Pods-acknowledgements.markdown new file mode 100644 index 0000000..0aa6cb5 --- /dev/null +++ b/Demo/Pods/Pods-acknowledgements.markdown @@ -0,0 +1,13 @@ +# Acknowledgements +This application makes use of the following third party libraries: + +## UIImage+Additions + +Copyright (c) 2013 Joan Martin, vilanovi@gmail.com. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE +Generated by CocoaPods - http://cocoapods.org diff --git a/Demo/Pods/Pods-acknowledgements.plist b/Demo/Pods/Pods-acknowledgements.plist new file mode 100644 index 0000000..f9d6415 --- /dev/null +++ b/Demo/Pods/Pods-acknowledgements.plist @@ -0,0 +1,43 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + Copyright (c) 2013 Joan Martin, vilanovi@gmail.com. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE + Title + UIImage+Additions + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - http://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/Demo/Pods/Pods-dummy.m b/Demo/Pods/Pods-dummy.m new file mode 100644 index 0000000..ade64bd --- /dev/null +++ b/Demo/Pods/Pods-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods : NSObject +@end +@implementation PodsDummy_Pods +@end diff --git a/Demo/Pods/Pods-environment.h b/Demo/Pods/Pods-environment.h new file mode 100644 index 0000000..a6798f2 --- /dev/null +++ b/Demo/Pods/Pods-environment.h @@ -0,0 +1,14 @@ + +// To check if a library is compiled with CocoaPods you +// can use the `COCOAPODS` macro definition which is +// defined in the xcconfigs so it is available in +// headers also when they are imported in the client +// project. + + +// UIImage+Additions +#define COCOAPODS_POD_AVAILABLE_UIImage_Additions +#define COCOAPODS_VERSION_MAJOR_UIImage_Additions 1 +#define COCOAPODS_VERSION_MINOR_UIImage_Additions 1 +#define COCOAPODS_VERSION_PATCH_UIImage_Additions 0 + diff --git a/Demo/Pods/Pods-resources.sh b/Demo/Pods/Pods-resources.sh new file mode 100755 index 0000000..39c2549 --- /dev/null +++ b/Demo/Pods/Pods-resources.sh @@ -0,0 +1,68 @@ +#!/bin/sh +set -e + +RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt +> "$RESOURCES_TO_COPY" + +install_resource() +{ + case $1 in + *.storyboard) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.xib) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.framework) + echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + ;; + *.xcdatamodel) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" + ;; + *.xcdatamodeld) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" + ;; + *.xcassets) + ;; + /*) + echo "$1" + echo "$1" >> "$RESOURCES_TO_COPY" + ;; + *) + echo "${PODS_ROOT}/$1" + echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" + ;; + esac +} + +rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +if [[ "${ACTION}" == "install" ]]; then + rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi +rm -f "$RESOURCES_TO_COPY" + +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ `xcrun --find actool` ] && [ `find . -name '*.xcassets' | wc -l` -ne 0 ] +then + case "${TARGETED_DEVICE_FAMILY}" in + 1,2) + TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" + ;; + 1) + TARGET_DEVICE_ARGS="--target-device iphone" + ;; + 2) + TARGET_DEVICE_ARGS="--target-device ipad" + ;; + *) + TARGET_DEVICE_ARGS="--target-device mac" + ;; + esac + find "${PWD}" -name "*.xcassets" -print0 | xargs -0 actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi diff --git a/Demo/Pods/Pods.xcconfig b/Demo/Pods/Pods.xcconfig new file mode 100644 index 0000000..200e653 --- /dev/null +++ b/Demo/Pods/Pods.xcconfig @@ -0,0 +1,5 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/UIImage+Additions" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers" -isystem "${PODS_ROOT}/Headers/UIImage+Additions" +OTHER_LDFLAGS = -ObjC -framework UIKit +PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/Demo/Pods/Pods.xcodeproj/project.pbxproj b/Demo/Pods/Pods.xcodeproj/project.pbxproj new file mode 100644 index 0000000..2283b1e --- /dev/null +++ b/Demo/Pods/Pods.xcodeproj/project.pbxproj @@ -0,0 +1,983 @@ + + + + + archiveVersion + 1 + classes + + objectVersion + 46 + objects + + 05E590EBE2674D74BA7E246F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + Pods-UIImage+Additions-prefix.pch + sourceTree + <group> + + 089F9A3059BD4039A3FDC192 + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + Foundation.framework + path + Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/Foundation.framework + sourceTree + DEVELOPER_DIR + + 19EDCEE99E4A45859F0D7EF1 + + fileRef + E7F80DC0E488405C871C43B9 + isa + PBXBuildFile + + 1A2F54E814D944E78038CB2F + + fileRef + 089F9A3059BD4039A3FDC192 + isa + PBXBuildFile + + 255D5BAC53C444ED94966621 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text + name + Podfile + path + ../Podfile + sourceTree + SOURCE_ROOT + xcLanguageSpecificationIdentifier + xcode.lang.ruby + + 2BCA69A906E54822819CE6DD + + buildActionMask + 2147483647 + files + + 1A2F54E814D944E78038CB2F + 19EDCEE99E4A45859F0D7EF1 + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 2F5436B6114D4A51904101FF + + buildConfigurations + + 5371B2225A0943E78A2A03A2 + E1A6817C7BAA4CB3BA117D31 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 2FE3CDA18FCE4451B59BA1AD + + isa + PBXTargetDependency + target + 4C702387862B463696C41A25 + targetProxy + 5C8F94F2170C4ED6BF6752A9 + + 327B3DA2FA754F019EF80E7C + + buildConfigurations + + E93AF7B2CF8C4946B22C7666 + DD039611EEFE4EC2B761389B + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 3539C68A6FA6497B887132A5 + + fileRef + 089F9A3059BD4039A3FDC192 + isa + PBXBuildFile + + 4A9CD423C4FB4544AAE0F610 + + buildActionMask + 2147483647 + files + + B1D601AEA45D4E54925EF9DF + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 4BA355968C3F470F8188C603 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text + path + Pods-acknowledgements.markdown + sourceTree + <group> + + 4C702387862B463696C41A25 + + buildConfigurationList + 5B876EE27A19430CA5AA2759 + buildPhases + + 70A7044809F74A90863C56C3 + CA1612547FD54038B3ADE2C8 + E0D4634C27354B25AF3F0DE4 + + buildRules + + dependencies + + isa + PBXNativeTarget + name + Pods-UIImage+Additions + productName + Pods-UIImage+Additions + productReference + E7F80DC0E488405C871C43B9 + productType + com.apple.product-type.library.static + + 4DD7E9A876094AF79959798D + + children + + B9CA4D4E922F4E1CB16854C3 + + isa + PBXGroup + name + Targets Support Files + sourceTree + <group> + + 5371B2225A0943E78A2A03A2 + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_MODULES + YES + CLANG_ENABLE_OBJC_ARC + NO + CLANG_WARN_BOOL_CONVERSION + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_DIRECT_OBJC_ISA_USAGE + YES + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN_OBJC_ROOT_CLASS + YES + COPY_PHASE_STRIP + YES + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + GCC_WARN_64_TO_32_BIT_CONVERSION + YES + GCC_WARN_ABOUT_RETURN_TYPE + YES + GCC_WARN_UNDECLARED_SELECTOR + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES + GCC_WARN_UNUSED_FUNCTION + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 7.0 + ONLY_ACTIVE_ARCH + YES + STRIP_INSTALLED_PRODUCT + NO + + isa + XCBuildConfiguration + name + Debug + + 5B876EE27A19430CA5AA2759 + + buildConfigurations + + 855BF7A33B9E42D6B37E8B56 + AE97BF7DE7414D60A3C39943 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 5C8F94F2170C4ED6BF6752A9 + + containerPortal + 714913E2D52D4AE7AE6382F9 + isa + PBXContainerItemProxy + proxyType + 1 + remoteGlobalIDString + 4C702387862B463696C41A25 + remoteInfo + Pods-UIImage+Additions + + 696EEFBC26E7405EAAE9060A + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + Pods-UIImage+Additions-dummy.m + sourceTree + <group> + + 6A99D4A089054418B3DB8D87 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.script.sh + path + Pods-resources.sh + sourceTree + <group> + + 70A7044809F74A90863C56C3 + + buildActionMask + 2147483647 + files + + 91FF5E9F90A542DF87CE43C7 + CF9AA1195B1141B69AA56771 + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 714913E2D52D4AE7AE6382F9 + + attributes + + LastUpgradeCheck + 0510 + + buildConfigurationList + 2F5436B6114D4A51904101FF + compatibilityVersion + Xcode 3.2 + developmentRegion + English + hasScannedForEncodings + 0 + isa + PBXProject + knownRegions + + en + + mainGroup + B7C3134C6B0E4E788AC19898 + productRefGroup + D5F3823FEFA444599DCC7C29 + projectDirPath + + projectReferences + + projectRoot + + targets + + F98DD63335A447FA8471D243 + 4C702387862B463696C41A25 + + + 855BF7A33B9E42D6B37E8B56 + + baseConfigurationReference + A3AFD85501534C77B1E61841 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + NO + DSTROOT + /tmp/xcodeproj.dst + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + Pods-UIImage+Additions-prefix.pch + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + GCC_VERSION + com.apple.compilers.llvm.clang.1_0 + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 7.0 + OTHER_LDFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + + isa + XCBuildConfiguration + name + Debug + + 86BA4B07DA03461EA6B06671 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + UIImage+Additions.h + sourceTree + <group> + + 8B487A05B73C439BA397AC9B + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + UIImage+Additions.m + sourceTree + <group> + + 91FF5E9F90A542DF87CE43C7 + + fileRef + 696EEFBC26E7405EAAE9060A + isa + PBXBuildFile + + 92AAAF138D9749E6ABE0D686 + + children + + 089F9A3059BD4039A3FDC192 + B7D26A45E919456CB10D75A4 + + isa + PBXGroup + name + iOS + sourceTree + <group> + + A3AFD85501534C77B1E61841 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods-UIImage+Additions-Private.xcconfig + sourceTree + <group> + + A892014D434943CC9596B03D + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.plist.xml + path + Pods-acknowledgements.plist + sourceTree + <group> + + AE97BF7DE7414D60A3C39943 + + baseConfigurationReference + A3AFD85501534C77B1E61841 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + YES + DSTROOT + /tmp/xcodeproj.dst + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + Pods-UIImage+Additions-prefix.pch + GCC_VERSION + com.apple.compilers.llvm.clang.1_0 + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 7.0 + OTHER_CFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_CPLUSPLUSFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_LDFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + B0144C2421F7438C9DA1D2C7 + + children + + 86BA4B07DA03461EA6B06671 + 8B487A05B73C439BA397AC9B + F7E86A5B64E843E09D7C78B0 + + isa + PBXGroup + name + UIImage+Additions + path + UIImage+Additions + sourceTree + <group> + + B184ADE50F9E4AD981FC9F95 + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods.a + sourceTree + BUILT_PRODUCTS_DIR + + B1D601AEA45D4E54925EF9DF + + fileRef + BE2D37DC8EAB47C59E1AB12F + isa + PBXBuildFile + + B7C3134C6B0E4E788AC19898 + + children + + 255D5BAC53C444ED94966621 + DC25B90EFC12459C89ED7DDF + E8135ADD8AFC4D0E86BDBFB7 + D5F3823FEFA444599DCC7C29 + 4DD7E9A876094AF79959798D + + isa + PBXGroup + sourceTree + <group> + + B7D26A45E919456CB10D75A4 + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + UIKit.framework + path + Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/UIKit.framework + sourceTree + DEVELOPER_DIR + + B9CA4D4E922F4E1CB16854C3 + + children + + FE80436EB4B54915891C9E5C + 4BA355968C3F470F8188C603 + A892014D434943CC9596B03D + BE2D37DC8EAB47C59E1AB12F + E0FBF68A2DF346B1BD3CC114 + 6A99D4A089054418B3DB8D87 + + isa + PBXGroup + name + Pods + sourceTree + <group> + + BA063C0735934D368F400446 + + fileRef + B7D26A45E919456CB10D75A4 + isa + PBXBuildFile + + BB9A74CF6F7249E585E2BC45 + + fileRef + 86BA4B07DA03461EA6B06671 + isa + PBXBuildFile + + BE2D37DC8EAB47C59E1AB12F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + Pods-dummy.m + sourceTree + <group> + + BFCF55EE12EF4EABA5C83AEB + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods-UIImage+Additions.xcconfig + sourceTree + <group> + + CA1612547FD54038B3ADE2C8 + + buildActionMask + 2147483647 + files + + 3539C68A6FA6497B887132A5 + BA063C0735934D368F400446 + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + CF9AA1195B1141B69AA56771 + + fileRef + 8B487A05B73C439BA397AC9B + isa + PBXBuildFile + settings + + COMPILER_FLAGS + -fobjc-arc -DOS_OBJECT_USE_OBJC=0 + + + D5F3823FEFA444599DCC7C29 + + children + + B184ADE50F9E4AD981FC9F95 + E7F80DC0E488405C871C43B9 + + isa + PBXGroup + name + Products + sourceTree + <group> + + DC25B90EFC12459C89ED7DDF + + children + + 92AAAF138D9749E6ABE0D686 + + isa + PBXGroup + name + Frameworks + sourceTree + <group> + + DD039611EEFE4EC2B761389B + + baseConfigurationReference + FE80436EB4B54915891C9E5C + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + YES + DSTROOT + /tmp/xcodeproj.dst + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_VERSION + com.apple.compilers.llvm.clang.1_0 + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 7.0 + OTHER_CFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_CPLUSPLUSFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_LDFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + E0D4634C27354B25AF3F0DE4 + + buildActionMask + 2147483647 + files + + BB9A74CF6F7249E585E2BC45 + + isa + PBXHeadersBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + E0FBF68A2DF346B1BD3CC114 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + Pods-environment.h + sourceTree + <group> + + E1A6817C7BAA4CB3BA117D31 + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_MODULES + YES + CLANG_ENABLE_OBJC_ARC + NO + CLANG_WARN_BOOL_CONVERSION + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_DIRECT_OBJC_ISA_USAGE + YES + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN_OBJC_ROOT_CLASS + YES + COPY_PHASE_STRIP + NO + ENABLE_NS_ASSERTIONS + NO + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_WARN_64_TO_32_BIT_CONVERSION + YES + GCC_WARN_ABOUT_RETURN_TYPE + YES + GCC_WARN_UNDECLARED_SELECTOR + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES + GCC_WARN_UNUSED_FUNCTION + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 7.0 + STRIP_INSTALLED_PRODUCT + NO + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + E7F80DC0E488405C871C43B9 + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods-UIImage+Additions.a + sourceTree + BUILT_PRODUCTS_DIR + + E8135ADD8AFC4D0E86BDBFB7 + + children + + B0144C2421F7438C9DA1D2C7 + + isa + PBXGroup + name + Pods + sourceTree + <group> + + E93AF7B2CF8C4946B22C7666 + + baseConfigurationReference + FE80436EB4B54915891C9E5C + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + NO + DSTROOT + /tmp/xcodeproj.dst + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + GCC_VERSION + com.apple.compilers.llvm.clang.1_0 + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 7.0 + OTHER_LDFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + + isa + XCBuildConfiguration + name + Debug + + F7E86A5B64E843E09D7C78B0 + + children + + BFCF55EE12EF4EABA5C83AEB + A3AFD85501534C77B1E61841 + 696EEFBC26E7405EAAE9060A + 05E590EBE2674D74BA7E246F + + isa + PBXGroup + name + Support Files + sourceTree + SOURCE_ROOT + + F98DD63335A447FA8471D243 + + buildConfigurationList + 327B3DA2FA754F019EF80E7C + buildPhases + + 4A9CD423C4FB4544AAE0F610 + 2BCA69A906E54822819CE6DD + + buildRules + + dependencies + + 2FE3CDA18FCE4451B59BA1AD + + isa + PBXNativeTarget + name + Pods + productName + Pods + productReference + B184ADE50F9E4AD981FC9F95 + productType + com.apple.product-type.library.static + + FE80436EB4B54915891C9E5C + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods.xcconfig + sourceTree + <group> + + + rootObject + 714913E2D52D4AE7AE6382F9 + + diff --git a/Demo/Pods/UIImage+Additions/LICENSE.txt b/Demo/Pods/UIImage+Additions/LICENSE.txt new file mode 100644 index 0000000..fccff84 --- /dev/null +++ b/Demo/Pods/UIImage+Additions/LICENSE.txt @@ -0,0 +1,7 @@ +Copyright (c) 2013 Joan Martin, vilanovi@gmail.com. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE \ No newline at end of file diff --git a/Demo/Pods/UIImage+Additions/README.md b/Demo/Pods/UIImage+Additions/README.md new file mode 100644 index 0000000..eec4f8e --- /dev/null +++ b/Demo/Pods/UIImage+Additions/README.md @@ -0,0 +1,81 @@ +UIImage-Additions +================= + +This category of UIImage add methods to generate dynamically images from colors, adding corner radius (for each corner), tinting images, etc. Use this category if you want to add "colored style" to your app without having to generate colored graphic resources. + +Right now the category supports four types of operations: + +###I. Create images for a color, size & corner radius + + +The folowing methods are used to generate a UIImage for a specific color, size and/or corner radius. + + + (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size; + + (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size cornerRadius:(CGFloat)cornerRadius; + + (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size cornerInset:(UICornerInset)cornerInset; + +###II. Create resizable images for a color & corner radius + +These methods are perfect to use inside `UIButton`s or `UIImageView`s if you are plannig to add a specific background color with a corner radius but you don't want to use `QuartzCore`. Also, you can specify which corner you want to round. + + + + (UIImage*)resizableImageWithColor:(UIColor*)color; + + (UIImage*)resizableImageWithColor:(UIColor*)color cornerRadius:(CGFloat)cornerRadius; + + (UIImage*)resizableImageWithColor:(UIColor*)color cornerInset:(UICornerInset)cornerInset; + + +###III. Generate image with rounded corners + +You can use these methods to get a corner rounded image version from a current image. + + - (UIImage*)imageWithRoundedBounds; + - (UIImage*)imageWithCornerRadius:(CGFloat)cornerRadius; + - (UIImage*)imageWithCornerInset:(UICornerInset)cornerInset; + - (BOOL)isValidCornerInset:(UICornerInset)cornerInset; + +###IV. Generate tinted image from existing image + +In order to avoid to generate multiple versions of the same image to use in different states (in `UIButton` for example), your designers can just create a single version and with these methods you can generate tinted versions of the same image. + + + (UIImage*)imageNamed:(NSString *)name tintColor:(UIColor*)color style:(UIImageTintedStyle)tintStyle; + - (UIImage*)tintedImageWithColor:(UIColor*)color style:(UIImageTintedStyle)tintStyle; + +You can use the following tint styles: + +* Use `UIImageTintedStyleKeepingAlpha` to keep transaprent pixels and tint only those that are not translucid. +* Use `UIImageTintedStyleOverAlpha` to keep non transparent pixels and tint only those that are translucid. + +###V. Superposing images + +You can easily create an image by superposing two images. Calling the method: + + - (UIImage *)imageAddingImage:(UIImage*)image offset:(CGPoint)offset; + +The result is an image with the caller image as background and the given image as a top image. Also, you can specify an offset for the top image. + +###VI. Generate Gradients +You can create linear gradient images (with two colors or more) using the following methods: + + + (UIImage*)imageWithGradient:(NSArray*)colors size:(CGSize)size direction:(UIImageGradientDirection)direction; + + (UIImage*)resizableImageWithGradient:(NSArray*)colors size:(CGSize)size direction:(UIImageGradientDirection)direction; + +The first method returns an image with a gradient using the specified colors and direction of the given size. +The second method returns the smallest resizable image that can generate the desired gradient for the given size. + + +### Notes + +1. This category take care of scaling properties depending of the device resolution (retina or not) or the original image scale property. + +2. All static methods cache images so two consequtives calls with the same parameters returns the same image. + +--- +## Licence ## + +Copyright (c) 2013 Joan Martin, vilanovi@gmail.com. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE diff --git a/Demo/Pods/UIImage+Additions/UIImage+Additions.h b/Demo/Pods/UIImage+Additions/UIImage+Additions.h new file mode 100644 index 0000000..073f05e --- /dev/null +++ b/Demo/Pods/UIImage+Additions/UIImage+Additions.h @@ -0,0 +1,139 @@ +// +// UIImage+Additions.h +// Created by Joan Martin. +// Take a look to my repos at http://github.com/vilanovi +// +// Copyright (c) 2013 Joan Martin, vilanovi@gmail.com. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE + +#import + +typedef struct __UICornerInset +{ + CGFloat topLeft; + CGFloat topRight; + CGFloat bottomLeft; + CGFloat bottomRight; +} UICornerInset; + +UIKIT_EXTERN const UICornerInset UICornerInsetZero; + +UIKIT_STATIC_INLINE UICornerInset UICornerInsetMake(CGFloat topLeft, CGFloat topRight, CGFloat bottomLeft, CGFloat bottomRight) +{ + UICornerInset cornerInset = {topLeft, topRight, bottomLeft, bottomRight}; + return cornerInset; +} + +UIKIT_STATIC_INLINE UICornerInset UICornerInsetMakeWithRadius(CGFloat radius) +{ + UICornerInset cornerInset = {radius, radius, radius, radius}; + return cornerInset; +} + +UIKIT_STATIC_INLINE BOOL UICornerInsetEqualToCornerInset(UICornerInset cornerInset1, UICornerInset cornerInset2) +{ + return + cornerInset1.topLeft == cornerInset2.topLeft && + cornerInset1.topRight == cornerInset2.topRight && + cornerInset1.bottomLeft == cornerInset2.bottomLeft && + cornerInset1.bottomRight == cornerInset2.bottomRight; +} + +FOUNDATION_EXTERN NSString* NSStringFromUICornerInset(UICornerInset cornerInset); + +typedef enum __UIImageTintedStyle +{ + UIImageTintedStyleKeepingAlpha = 1, + UIImageTintedStyleOverAlpha = 2 +} UIImageTintedStyle; + +typedef enum __UIImageGradientDirection +{ + UIImageGradientDirectionVertical = 1, + UIImageGradientDirectionHorizontal = 2, +} UIImageGradientDirection; + +@interface UIImage (Additions) + +/* + * Create images from colors + */ ++ (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size; ++ (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size cornerRadius:(CGFloat)cornerRadius; ++ (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size cornerInset:(UICornerInset)cornerInset; + +/* + * Create rezisable images from colors + */ ++ (UIImage*)resizableImageWithColor:(UIColor*)color; ++ (UIImage*)resizableImageWithColor:(UIColor*)color cornerRadius:(CGFloat)cornerRadius; ++ (UIImage*)resizableImageWithColor:(UIColor*)color cornerInset:(UICornerInset)cornerInset; + ++ (UIImage*)blackColorImage; ++ (UIImage*)darkGrayColorImage; ++ (UIImage*)lightGrayColorImage; ++ (UIImage*)whiteColorImage; ++ (UIImage*)grayColorImage; ++ (UIImage*)redColorImage; ++ (UIImage*)greenColorImage; ++ (UIImage*)blueColorImage; ++ (UIImage*)cyanColorImage; ++ (UIImage*)yellowColorImage; ++ (UIImage*)magentaColorImage; ++ (UIImage*)orangeColorImage; ++ (UIImage*)purpleColorImage; ++ (UIImage*)brownColorImage; ++ (UIImage*)clearColorImage; + +/* + * Tint Images + */ ++ (UIImage*)imageNamed:(NSString *)name tintColor:(UIColor*)color style:(UIImageTintedStyle)tintStyle; +- (UIImage*)tintedImageWithColor:(UIColor*)color style:(UIImageTintedStyle)tintStyle; + +/* + * Rounding corners + */ +- (UIImage*)imageWithRoundedBounds; +- (UIImage*)imageWithCornerRadius:(CGFloat)cornerRadius; +- (UIImage*)imageWithCornerInset:(UICornerInset)cornerInset; +- (BOOL)isValidCornerInset:(UICornerInset)cornerInset; + +/* + * Drawing image on image + */ +- (UIImage*)imageAddingImage:(UIImage*)image; +- (UIImage*)imageAddingImage:(UIImage*)image offset:(CGPoint)offset; + +/* + * Gradient image generation + */ ++ (UIImage*)imageWithGradient:(NSArray*)colors size:(CGSize)size direction:(UIImageGradientDirection)direction; ++ (UIImage*)resizableImageWithGradient:(NSArray*)colors size:(CGSize)size direction:(UIImageGradientDirection)direction; + +@end + +#pragma mark - Categories + +@interface NSValue (UICornerInset) + ++ (NSValue*)valueWithUICornerInset:(UICornerInset)cornerInset; +- (UICornerInset)UICornerInsetValue; + +@end diff --git a/Demo/Pods/UIImage+Additions/UIImage+Additions.m b/Demo/Pods/UIImage+Additions/UIImage+Additions.m new file mode 100644 index 0000000..0ceada5 --- /dev/null +++ b/Demo/Pods/UIImage+Additions/UIImage+Additions.m @@ -0,0 +1,601 @@ +// +// UIImage+Additions.m +// Created by Joan Martin. +// Take a look to my repos at http://github.com/vilanovi +// +// Copyright (c) 2013 Joan Martin, vilanovi@gmail.com. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE + +#import "UIImage+Additions.h" + +@interface NSString (MD5Hashing) + +- (NSString*)md5; + +@end + +#import + +@implementation NSString (MD5Hashing) + +- (NSString *)md5 +{ + const char *cStr = [self UTF8String]; + unsigned char result[16]; + + CC_MD5(cStr, (CC_LONG)strlen(cStr), result); + + return [NSString stringWithFormat: + @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + result[0], result[1], result[2], result[3], + result[4], result[5], result[6], result[7], + result[8], result[9], result[10], result[11], + result[12], result[13], result[14], result[15] + ]; +} + +@end + +const UICornerInset UICornerInsetZero = {0.0f, 0.0f, 0.0f, 0.0f}; + +NSString* NSStringFromUICornerInset(UICornerInset cornerInset) +{ + return [NSString stringWithFormat:@"UICornerInset ",cornerInset.topLeft, cornerInset.topRight, cornerInset.bottomLeft, cornerInset.bottomRight]; +} + +static NSCache * _imageCache = nil; + +static NSString * kUIImageName = @"kUIImageName"; +static NSString * kUIImageResizableImage = @"kUIImageResizableImage"; +static NSString * kUIImageColors = @"kUIImageColors"; +static NSString * kUIImageTintColor = @"kUIImageTintColor"; +static NSString * kUIImageTintStyle = @"kUIImageTintStyle"; +static NSString * kUIImageCornerInset = @"kUIImageCornerInset"; +static NSString * kUIImageGradientDirection = @"kUIImageGradientDirection"; +static NSString * kUIImageSize = @"kUIImageSize"; + +@implementation UIImage (Additions) + ++ (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size +{ + return [self imageWithColor:color size:size cornerInset:UICornerInsetZero]; +} + ++ (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size cornerRadius:(CGFloat)cornerRadius +{ + return [self imageWithColor:color size:size cornerInset:UICornerInsetMake(cornerRadius, cornerRadius, cornerRadius, cornerRadius)]; +} + ++ (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size cornerInset:(UICornerInset)cornerInset +{ + return [self _imageWithColor:color size:size cornerInset:cornerInset saveInCache:YES]; +} + ++ (UIImage*)resizableImageWithColor:(UIColor*)color +{ + return [self resizableImageWithColor:color cornerInset:UICornerInsetZero]; +} + ++ (UIImage*)resizableImageWithColor:(UIColor*)color cornerRadius:(CGFloat)cornerRadius +{ + return [self resizableImageWithColor:color cornerInset:UICornerInsetMake(cornerRadius, cornerRadius, cornerRadius, cornerRadius)]; +} + ++ (UIImage*)resizableImageWithColor:(UIColor*)color cornerInset:(UICornerInset)cornerInset +{ + if (!color) + return nil; + + NSDictionary *descriptors = @{kUIImageColors : @[color], + kUIImageResizableImage : @YES, + kUIImageCornerInset : [NSValue valueWithUICornerInset:cornerInset]}; + + UIImage *image = [self _cachedImageWithDescriptors:descriptors]; + + if (image) + return image; + + CGSize size = CGSizeMake(MAX(cornerInset.topLeft, cornerInset.bottomLeft) + MAX(cornerInset.topRight, cornerInset.bottomRight) + 1, + MAX(cornerInset.topLeft, cornerInset.topRight) + MAX(cornerInset.bottomLeft, cornerInset.bottomRight) + 1); + + UIEdgeInsets capInsets = UIEdgeInsetsMake(MAX(cornerInset.topLeft, cornerInset.topRight), + MAX(cornerInset.topLeft, cornerInset.bottomLeft), + MAX(cornerInset.bottomLeft, cornerInset.bottomRight), + MAX(cornerInset.topRight, cornerInset.bottomRight)); + + image = [[self imageWithColor:color size:size cornerInset:cornerInset] resizableImageWithCapInsets:capInsets]; + + [self _cacheImage:image withDescriptors:descriptors]; + + return image; +} + ++ (UIImage*)blackColorImage +{ + return [self resizableImageWithColor:[UIColor blackColor]]; +} + ++ (UIImage*)darkGrayColorImage +{ + return [self resizableImageWithColor:[UIColor darkGrayColor]]; +} + ++ (UIImage*)lightGrayColorImage +{ + return [self resizableImageWithColor:[UIColor lightGrayColor]]; +} + ++ (UIImage*)whiteColorImage +{ + return [self resizableImageWithColor:[UIColor whiteColor]]; +} + ++ (UIImage*)grayColorImage +{ + return [self resizableImageWithColor:[UIColor grayColor]]; +} + ++ (UIImage*)redColorImage +{ + return [self resizableImageWithColor:[UIColor redColor]]; +} + ++ (UIImage*)greenColorImage +{ + return [self resizableImageWithColor:[UIColor greenColor]]; +} + ++ (UIImage*)blueColorImage +{ + return [self resizableImageWithColor:[UIColor blueColor]]; +} + ++ (UIImage*)cyanColorImage +{ + return [self resizableImageWithColor:[UIColor cyanColor]]; +} + ++ (UIImage*)yellowColorImage +{ + return [self resizableImageWithColor:[UIColor yellowColor]]; +} + ++ (UIImage*)magentaColorImage +{ + return [self resizableImageWithColor:[UIColor magentaColor]]; +} + ++ (UIImage*)orangeColorImage +{ + return [self resizableImageWithColor:[UIColor orangeColor]]; +} + ++ (UIImage*)purpleColorImage +{ + return [self resizableImageWithColor:[UIColor purpleColor]]; +} + ++ (UIImage*)brownColorImage +{ + return [self resizableImageWithColor:[UIColor brownColor]]; +} + ++ (UIImage*)clearColorImage +{ + return [self resizableImageWithColor:[UIColor clearColor]]; +} + ++ (UIImage*)imageNamed:(NSString *)name tintColor:(UIColor*)color style:(UIImageTintedStyle)tintStyle +{ + if (!name) + return nil; + + UIImage *image = [UIImage imageNamed:name]; + + if (!image) + return nil; + + if (!color) + return image; + + NSDictionary *descriptors = @{kUIImageName : name, + kUIImageTintColor : color, + kUIImageTintStyle : @(tintStyle)}; + + UIImage *tintedImage = [self _cachedImageWithDescriptors:descriptors]; + + if (!tintedImage) + { + tintedImage = [image tintedImageWithColor:color style:tintStyle]; + [self _cacheImage:tintedImage withDescriptors:descriptors]; + } + + return tintedImage; +} + +- (UIImage*)tintedImageWithColor:(UIColor*)color style:(UIImageTintedStyle)tintStyle +{ + if (!color) + return self; + + CGFloat scale = self.scale; + CGSize size = CGSizeMake(scale * self.size.width, scale * self.size.height); + + UIGraphicsBeginImageContext(size); + + CGContextRef context = UIGraphicsGetCurrentContext(); + + CGContextTranslateCTM(context, 0, size.height); + CGContextScaleCTM(context, 1.0, -1.0); + + CGRect rect = CGRectMake(0, 0, size.width, size.height); + // --- + + if (tintStyle == UIImageTintedStyleOverAlpha) + { + [color setFill]; + CGContextFillRect(context, rect); + } + + // draw alpha-mask + CGContextSetBlendMode(context, kCGBlendModeNormal); + CGContextDrawImage(context, rect, self.CGImage); + + if (tintStyle == UIImageTintedStyleKeepingAlpha) + { + CGContextSetBlendMode(context, kCGBlendModeSourceIn); + [color setFill]; + CGContextFillRect(context, rect); + } + + // --- + CGImageRef bitmapContext = CGBitmapContextCreateImage(context); + + UIImage *coloredImage = [UIImage imageWithCGImage:bitmapContext scale:scale orientation:UIImageOrientationUp]; + + CGImageRelease(bitmapContext); + + UIGraphicsEndImageContext(); + + return coloredImage; +} + +- (UIImage*)imageWithRoundedBounds +{ + CGSize size = self.size; + CGFloat radius = MIN(size.width, size.height) / 2.0; + return [self imageWithCornerRadius:radius]; +} + +- (UIImage*)imageWithCornerRadius:(CGFloat)cornerRadius +{ + return [self imageWithCornerInset:UICornerInsetMake(cornerRadius, cornerRadius, cornerRadius, cornerRadius)]; +} + +- (UIImage *)imageWithCornerInset:(UICornerInset)cornerInset +{ + if (![self isValidCornerInset:cornerInset]) + return nil; + + CGFloat scale = self.scale; + + CGRect rect = CGRectMake(0.0f, 0.0f, scale*self.size.width, scale*self.size.height); + + cornerInset.topRight *= scale; + cornerInset.topLeft *= scale; + cornerInset.bottomLeft *= scale; + cornerInset.bottomRight *= scale; + + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CGContextRef context = CGBitmapContextCreate(NULL, rect.size.width, rect.size.height, 8, 0, colorSpace, (CGBitmapInfo)kCGImageAlphaPremultipliedLast); + CGColorSpaceRelease(colorSpace); + + if (context == NULL) + return nil; + + CGFloat minx = CGRectGetMinX(rect), midx = CGRectGetMidX(rect), maxx = CGRectGetMaxX(rect); + CGFloat miny = CGRectGetMinY(rect), midy = CGRectGetMidY(rect), maxy = CGRectGetMaxY(rect); + CGContextBeginPath(context); + CGContextMoveToPoint(context, minx, midy); + CGContextAddArcToPoint(context, minx, miny, midx, miny, cornerInset.bottomLeft); + CGContextAddArcToPoint(context, maxx, miny, maxx, midy, cornerInset.bottomRight); + CGContextAddArcToPoint(context, maxx, maxy, midx, maxy, cornerInset.topRight); + CGContextAddArcToPoint(context, minx, maxy, minx, midy, cornerInset.topLeft); + CGContextClosePath(context); + CGContextClip(context); + + CGContextDrawImage(context, rect, self.CGImage); + + CGImageRef bitmapImageRef = CGBitmapContextCreateImage(context); + + CGContextRelease(context); + + UIImage *newImage = [UIImage imageWithCGImage:bitmapImageRef scale:scale orientation:UIImageOrientationUp]; + + CGImageRelease(bitmapImageRef); + + return newImage; +} + +- (BOOL)isValidCornerInset:(UICornerInset)cornerInset +{ + CGSize size = self.size; + + BOOL isValid = YES; + + if (cornerInset.topLeft + cornerInset.topRight > size.width) + isValid = NO; + + else if (cornerInset.topRight + cornerInset.bottomRight > size.height) + isValid = NO; + + else if (cornerInset.bottomRight + cornerInset.bottomLeft > size.width) + isValid = NO; + + else if (cornerInset.bottomLeft + cornerInset.topLeft > size.height) + isValid = NO; + + return isValid; +} + +- (UIImage*)imageAddingImage:(UIImage*)image +{ + CGSize size1 = self.size; + CGSize size2 = image.size; + + CGPoint offset = CGPointMake(floorf((size1.width - size2.width)/2.0), + floorf((size1.height - size2.height)/2.0)); + return [self imageAddingImage:image offset:offset]; +} + +- (UIImage*)imageAddingImage:(UIImage*)image offset:(CGPoint)offset +{ + CGSize size = self.size; + CGFloat scale = self.scale; + + size.width *= scale; + size.height *= scale; + + UIGraphicsBeginImageContext(size); + + [self drawInRect:CGRectMake( 0, 0, size.width, size.height)]; + + [image drawInRect:CGRectMake(scale * offset.x, scale * offset.y, image.size.width * scale, image.size.height * scale)]; + + CGContextRef context = UIGraphicsGetCurrentContext(); + CGImageRef bitmapContext = CGBitmapContextCreateImage(context); + UIImage *destImage = [UIImage imageWithCGImage:bitmapContext scale:image.scale orientation:UIImageOrientationUp]; + UIGraphicsEndImageContext(); + CGImageRelease(bitmapContext); + + return destImage; +} + +#pragma mark Private Methods + ++ (NSCache*)_cache +{ + if (!_imageCache) + _imageCache = [[NSCache alloc] init]; + + return _imageCache; +} + ++ (UIImage*)_cachedImageWithDescriptors:(NSDictionary*)descriptors +{ + return [[self _cache] objectForKey:[self _keyForImageWithDescriptors:descriptors]]; +} + ++ (void)_cacheImage:(UIImage*)image withDescriptors:(NSDictionary*)descriptors +{ + NSString *key = [self _keyForImageWithDescriptors:descriptors]; + [[self _cache] setObject:image forKey:key]; +} + ++ (NSString*)_keyForImageWithDescriptors:(NSDictionary*)descriptors +{ + NSMutableString *string = [NSMutableString string]; + + NSString *imageName = [descriptors valueForKey:kUIImageName]; + [string appendFormat:@"<%@:%@>",kUIImageName,(imageName == nil)?@"":imageName]; + [string appendFormat:@"<%@:%@>",kUIImageSize, NSStringFromCGSize([[descriptors valueForKey:kUIImageSize] CGSizeValue])]; + [string appendFormat:@"<%@:%d>",kUIImageResizableImage,[[descriptors valueForKey:kUIImageResizableImage] boolValue]]; + + [string appendFormat:@"<%@:",kUIImageColors]; + NSArray *colors = [descriptors valueForKey:kUIImageColors]; + for (UIColor *color in colors) + [string appendFormat:@"%ld",(long)color.hash]; + [string appendFormat:@">"]; + + [string appendFormat:@"<%@:%ld>",kUIImageTintColor,(long)[[descriptors valueForKey:kUIImageTintColor] hash]]; + [string appendFormat:@"<%@:%ld>",kUIImageTintStyle,(long)[[descriptors valueForKey:kUIImageTintStyle] integerValue]]; + [string appendFormat:@"<%@:%@>",kUIImageCornerInset,NSStringFromUICornerInset([[descriptors valueForKey:kUIImageCornerInset] UICornerInsetValue])]; + [string appendFormat:@"<%@:%ld>",kUIImageGradientDirection,(long)[[descriptors valueForKey:kUIImageGradientDirection] integerValue]]; + + return [string md5]; +} + ++ (UIImage*)_imageWithColor:(UIColor*)color size:(CGSize)size cornerInset:(UICornerInset)cornerInset saveInCache:(BOOL)save +{ + NSDictionary *descriptors = @{kUIImageColors : @[color], + kUIImageSize : [NSValue valueWithCGSize:size], + kUIImageCornerInset : [NSValue valueWithUICornerInset:cornerInset]}; + + UIImage *image = [self _cachedImageWithDescriptors:descriptors]; + + if (image) + return image; + + CGFloat scale = [[UIScreen mainScreen] scale]; + CGRect rect = CGRectMake(0.0f, 0.0f, scale*size.width, scale*size.height); + + cornerInset.topRight *= scale; + cornerInset.topLeft *= scale; + cornerInset.bottomLeft *= scale; + cornerInset.bottomRight *= scale; + + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CGContextRef context = CGBitmapContextCreate(NULL, rect.size.width, rect.size.height, 8, 0, colorSpace, (CGBitmapInfo)kCGImageAlphaPremultipliedLast); + + CGColorSpaceRelease(colorSpace); + + if (context == NULL) + return nil; + + CGFloat minx = CGRectGetMinX(rect), midx = CGRectGetMidX(rect), maxx = CGRectGetMaxX(rect); + CGFloat miny = CGRectGetMinY(rect), midy = CGRectGetMidY(rect), maxy = CGRectGetMaxY(rect); + + CGContextBeginPath(context); + CGContextSetGrayFillColor(context, 1.0, 0.0); // <-- Alpha color in background + CGContextAddRect(context, rect); + CGContextClosePath(context); + CGContextDrawPath(context, kCGPathFill); + + CGContextSetFillColorWithColor(context, [color CGColor]); // <-- Color to fill + CGContextBeginPath(context); + CGContextMoveToPoint(context, minx, midy); + CGContextAddArcToPoint(context, minx, miny, midx, miny, cornerInset.bottomLeft); + CGContextAddArcToPoint(context, maxx, miny, maxx, midy, cornerInset.bottomRight); + CGContextAddArcToPoint(context, maxx, maxy, midx, maxy, cornerInset.topRight); + CGContextAddArcToPoint(context, minx, maxy, minx, midy, cornerInset.topLeft); + CGContextClosePath(context); + CGContextDrawPath(context, kCGPathFill); + + CGImageRef bitmapContext = CGBitmapContextCreateImage(context); + + CGContextRelease(context); + + UIImage *theImage = [UIImage imageWithCGImage:bitmapContext scale:scale orientation:UIImageOrientationUp]; + + CGImageRelease(bitmapContext); + + if (save) + [self _cacheImage:theImage withDescriptors:descriptors]; + + return theImage; +} + ++ (UIImage*)imageWithGradient:(NSArray*)colors size:(CGSize)size direction:(UIImageGradientDirection)direction +{ + + NSDictionary *descriptors = @{kUIImageColors: colors, + kUIImageSize: [NSValue valueWithCGSize:size], + kUIImageGradientDirection: @(direction)}; + + UIImage *image = [self _cachedImageWithDescriptors:descriptors]; + if (image) + return image; + + CGRect rect = CGRectMake(0, 0, size.width, size.height); + + UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0.0); + + CGContextRef context = UIGraphicsGetCurrentContext(); + + // Create Gradient + NSMutableArray *cgColors = [NSMutableArray arrayWithCapacity:colors.count]; + for (UIColor *color in colors) + [cgColors addObject:(id)color.CGColor]; + + CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB(); + CGGradientRef gradient = CGGradientCreateWithColors(space, (__bridge CFArrayRef)cgColors, NULL); + + // Apply gradient + CGPoint startPoint = CGPointZero; + CGPoint endPoint = CGPointZero; + + if (direction == UIImageGradientDirectionVertical) + endPoint = CGPointMake(0, rect.size.height); + + else if (direction == UIImageGradientDirectionHorizontal) + endPoint = CGPointMake(rect.size.width, 0); + + CGContextDrawLinearGradient(context, gradient, startPoint, endPoint, 0); + image = UIGraphicsGetImageFromCurrentImageContext(); + + // Clean memory & End context + UIGraphicsEndImageContext(); + CGGradientRelease(gradient); + CGColorSpaceRelease(space); + + [self _cacheImage:image withDescriptors:descriptors]; + + return image; +} + ++ (UIImage*)resizableImageWithGradient:(NSArray*)colors size:(CGSize)size direction:(UIImageGradientDirection)direction +{ + if ((size.width == 0.0f && direction == UIImageGradientDirectionHorizontal) || + (size.height == 0.0f && direction == UIImageGradientDirectionVertical) || + (size.height == 0.0f && size.width == 0.0f)) + return nil; + + NSDictionary *descriptors = @{kUIImageColors: colors, + kUIImageSize: [NSValue valueWithCGSize:size], + kUIImageGradientDirection: @(direction), + kUIImageResizableImage: @YES}; + + UIImage *image = [self _cachedImageWithDescriptors:descriptors]; + if (image) + return image; + + CGSize imageSize = CGSizeMake(1.0f, 1.0f); + + UIEdgeInsets insets = UIEdgeInsetsZero; + + if (direction == UIImageGradientDirectionVertical) + { + imageSize.height = size.height; + insets = UIEdgeInsetsMake(0.0f, 1.0f, 0.0f, 1.0f); + } + else if (direction == UIImageGradientDirectionHorizontal) + { + imageSize.width = size.width; + insets = UIEdgeInsetsMake(1.0f, 0.0f, 1.0f, 0.0f); + } + + return [[self imageWithGradient:colors size:imageSize direction:direction] resizableImageWithCapInsets:insets]; +} + +@end + +#pragma mark - Categories + +@implementation NSValue (UICornerInset) + ++ (NSValue*)valueWithUICornerInset:(UICornerInset)cornerInset +{ + CGRect rect = CGRectMake(cornerInset.topLeft, cornerInset.topRight, cornerInset.bottomLeft, cornerInset.bottomRight); + return [NSValue valueWithCGRect:rect]; + + // UICornerInset inset = cornerInset; + // return [[NSValue alloc] initWithBytes:&inset objCType:@encode(struct __UICornerInset)]; +} + +- (UICornerInset)UICornerInsetValue +{ + CGRect rect = [self CGRectValue]; + return UICornerInsetMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); + + // UICornerInset cornerInset; + // [self getValue:&cornerInset]; + // return cornerInset; +} + +@end From 1e7f78350cbe3737239c5bb5a2ca32d2745c66cf Mon Sep 17 00:00:00 2001 From: Mathias Amnell Date: Wed, 16 Jul 2014 12:37:26 +0200 Subject: [PATCH 2/6] Initial implementation of min-height and added fix for scrollbar offset --- .../UIScrollView+APParallaxHeader.m | 47 +- .../project.pbxproj | 1239 ++++++++++++----- .../APParallaxHeaderDemo-Prefix.pch | 2 + .../MasterViewController.m | 15 +- .../en.lproj/MainStoryboard.storyboard | 34 +- Demo/Podfile | 4 + Demo/Podfile.lock | 10 + .../UIImage+Additions/UIImage+Additions.h | 1 + .../UIImage+Additions/UIImage+Additions.h | 1 + Demo/Pods/Manifest.lock | 10 + .../Pods-UIImage+Additions-Private.xcconfig | 5 + Demo/Pods/Pods-UIImage+Additions-dummy.m | 5 + Demo/Pods/Pods-UIImage+Additions-prefix.pch | 5 + Demo/Pods/Pods-UIImage+Additions.xcconfig | 1 + Demo/Pods/Pods-acknowledgements.markdown | 13 + Demo/Pods/Pods-acknowledgements.plist | 43 + Demo/Pods/Pods-dummy.m | 5 + Demo/Pods/Pods-environment.h | 14 + Demo/Pods/Pods-resources.sh | 68 + Demo/Pods/Pods.xcconfig | 5 + Demo/Pods/Pods.xcodeproj/project.pbxproj | 983 +++++++++++++ Demo/Pods/UIImage+Additions/LICENSE.txt | 7 + Demo/Pods/UIImage+Additions/README.md | 81 ++ .../UIImage+Additions/UIImage+Additions.h | 139 ++ .../UIImage+Additions/UIImage+Additions.m | 601 ++++++++ 25 files changed, 2962 insertions(+), 376 deletions(-) create mode 100644 Demo/Podfile create mode 100644 Demo/Podfile.lock create mode 120000 Demo/Pods/BuildHeaders/UIImage+Additions/UIImage+Additions.h create mode 120000 Demo/Pods/Headers/UIImage+Additions/UIImage+Additions.h create mode 100644 Demo/Pods/Manifest.lock create mode 100644 Demo/Pods/Pods-UIImage+Additions-Private.xcconfig create mode 100644 Demo/Pods/Pods-UIImage+Additions-dummy.m create mode 100644 Demo/Pods/Pods-UIImage+Additions-prefix.pch create mode 100644 Demo/Pods/Pods-UIImage+Additions.xcconfig create mode 100644 Demo/Pods/Pods-acknowledgements.markdown create mode 100644 Demo/Pods/Pods-acknowledgements.plist create mode 100644 Demo/Pods/Pods-dummy.m create mode 100644 Demo/Pods/Pods-environment.h create mode 100755 Demo/Pods/Pods-resources.sh create mode 100644 Demo/Pods/Pods.xcconfig create mode 100644 Demo/Pods/Pods.xcodeproj/project.pbxproj create mode 100644 Demo/Pods/UIImage+Additions/LICENSE.txt create mode 100644 Demo/Pods/UIImage+Additions/README.md create mode 100644 Demo/Pods/UIImage+Additions/UIImage+Additions.h create mode 100644 Demo/Pods/UIImage+Additions/UIImage+Additions.m diff --git a/APParallaxHeader/UIScrollView+APParallaxHeader.m b/APParallaxHeader/UIScrollView+APParallaxHeader.m index 376ffce..10ff8d3 100755 --- a/APParallaxHeader/UIScrollView+APParallaxHeader.m +++ b/APParallaxHeader/UIScrollView+APParallaxHeader.m @@ -21,8 +21,6 @@ @interface APParallaxView () @end - - #pragma mark - UIScrollView (APParallaxHeader) #import @@ -122,8 +120,8 @@ - (BOOL)showsParallax { #pragma mark - ShadowLayer @implementation APParallaxShadowView -- (id)initWithFrame:(CGRect)frame -{ + +- (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self setOpaque:NO]; @@ -131,8 +129,7 @@ - (id)initWithFrame:(CGRect)frame return self; } -- (void)drawRect:(CGRect)rect -{ +- (void)drawRect:(CGRect)rect { [super drawRect:rect]; //// General Declarations @@ -158,7 +155,6 @@ - (void)drawRect:(CGRect)rect //// Cleanup CGGradientRelease(gradient3); CGColorSpaceRelease(colorSpace); - } @end @@ -168,7 +164,7 @@ - (void)drawRect:(CGRect)rect @implementation APParallaxView - (id)initWithFrame:(CGRect)frame { - if(self = [super initWithFrame:frame]) { + if (self = [super initWithFrame:frame]) { // default styling values [self setAutoresizingMask:UIViewAutoresizingFlexibleHeight]; @@ -203,8 +199,7 @@ - (void)willMoveToSuperview:(UIView *)newSuperview { } } -- (void)addSubview:(UIView *)view -{ +- (void)addSubview:(UIView *)view { [super addSubview:view]; self.currentSubView = view; } @@ -212,22 +207,26 @@ - (void)addSubview:(UIView *)view #pragma mark - Observing - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - if([keyPath isEqualToString:@"contentOffset"]) + if([keyPath isEqualToString:@"contentOffset"]) { [self scrollViewDidScroll:[[change valueForKey:NSKeyValueChangeNewKey] CGPointValue]]; - else if([keyPath isEqualToString:@"frame"]) + } + else if([keyPath isEqualToString:@"frame"]) { [self layoutSubviews]; + } } +#define MIN_HEIGHT 64 + - (void)scrollViewDidScroll:(CGPoint)contentOffset { - // We do not want to track when the parallax view is hidden - if (contentOffset.y > 0) { - [self setState:APParallaxTrackingInactive]; - } else { - [self setState:APParallaxTrackingActive]; + // Resize/reposition the parallaxView based on the content offset + CGFloat yOffset = contentOffset.y*-1; + if (yOffset <= MIN_HEIGHT) { + CGRect rect = self.frame; + rect.origin.y = contentOffset.y; + rect.size.height = MAX(MIN_HEIGHT, yOffset); + self.frame = rect; } - - if(self.state == APParallaxTrackingActive) { - CGFloat yOffset = contentOffset.y*-1; + else { if ([self.delegate respondsToSelector:@selector(parallaxView:willChangeFrame:)]) { [self.delegate parallaxView:self willChangeFrame:self.frame]; } @@ -238,6 +237,14 @@ - (void)scrollViewDidScroll:(CGPoint)contentOffset { [self.delegate parallaxView:self didChangeFrame:self.frame]; } } + + // Correct the scroll indicator position + if (self.scrollView.contentOffset.y < -self.parallaxHeight) { + [self.scrollView setScrollIndicatorInsets:UIEdgeInsetsMake(self.scrollView.contentInset.top+(abs(self.scrollView.contentOffset.y)-self.parallaxHeight), 0, 0, 0)]; + } + else { + [self.scrollView setScrollIndicatorInsets:UIEdgeInsetsMake(self.scrollView.contentInset.top, 0, 0, 0)]; + } } @end diff --git a/Demo/APParallaxHeaderDemo.xcodeproj/project.pbxproj b/Demo/APParallaxHeaderDemo.xcodeproj/project.pbxproj index 0a98333..4aa8bfe 100644 --- a/Demo/APParallaxHeaderDemo.xcodeproj/project.pbxproj +++ b/Demo/APParallaxHeaderDemo.xcodeproj/project.pbxproj @@ -1,335 +1,904 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 113BBD0A171B0A3800BC6574 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 113BBD09171B0A3800BC6574 /* QuartzCore.framework */; }; - A697F31F17A02B5F003B821D /* Rover.jpg in Resources */ = {isa = PBXBuildFile; fileRef = A697F31E17A02B5F003B821D /* Rover.jpg */; }; - C72B531F171834E60093E24F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C72B531E171834E60093E24F /* UIKit.framework */; }; - C72B5321171834E60093E24F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C72B5320171834E60093E24F /* Foundation.framework */; }; - C72B5323171834E60093E24F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C72B5322171834E60093E24F /* CoreGraphics.framework */; }; - C72B5329171834E60093E24F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = C72B5327171834E60093E24F /* InfoPlist.strings */; }; - C72B532B171834E60093E24F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C72B532A171834E60093E24F /* main.m */; }; - C72B532F171834E60093E24F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C72B532E171834E60093E24F /* AppDelegate.m */; }; - C72B5331171834E60093E24F /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = C72B5330171834E60093E24F /* Default.png */; }; - C72B5333171834E60093E24F /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C72B5332171834E60093E24F /* Default@2x.png */; }; - C72B5335171834E60093E24F /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C72B5334171834E60093E24F /* Default-568h@2x.png */; }; - C72B5338171834E60093E24F /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C72B5336171834E60093E24F /* MainStoryboard.storyboard */; }; - C72B533B171834E60093E24F /* MasterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C72B533A171834E60093E24F /* MasterViewController.m */; }; - C7E3C5FF17183E4500489EE2 /* ParallaxImage.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C7E3C5FE17183E4500489EE2 /* ParallaxImage.jpg */; }; - C7E3C605171842CA00489EE2 /* UIScrollView+APParallaxHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = C7E3C604171842CA00489EE2 /* UIScrollView+APParallaxHeader.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 113BBD09171B0A3800BC6574 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - A697F31E17A02B5F003B821D /* Rover.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Rover.jpg; sourceTree = ""; }; - C72B531B171834E60093E24F /* APParallaxHeaderDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = APParallaxHeaderDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; - C72B531E171834E60093E24F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - C72B5320171834E60093E24F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - C72B5322171834E60093E24F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - C72B5326171834E60093E24F /* APParallaxHeaderDemo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "APParallaxHeaderDemo-Info.plist"; sourceTree = ""; }; - C72B5328171834E60093E24F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - C72B532A171834E60093E24F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - C72B532C171834E60093E24F /* APParallaxHeaderDemo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "APParallaxHeaderDemo-Prefix.pch"; sourceTree = ""; }; - C72B532D171834E60093E24F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; - C72B532E171834E60093E24F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - C72B5330171834E60093E24F /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; - C72B5332171834E60093E24F /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; - C72B5334171834E60093E24F /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; - C72B5337171834E60093E24F /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard.storyboard; sourceTree = ""; }; - C72B5339171834E60093E24F /* MasterViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MasterViewController.h; sourceTree = ""; }; - C72B533A171834E60093E24F /* MasterViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MasterViewController.m; sourceTree = ""; }; - C7E3C5FE17183E4500489EE2 /* ParallaxImage.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = ParallaxImage.jpg; sourceTree = ""; }; - C7E3C603171842CA00489EE2 /* UIScrollView+APParallaxHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+APParallaxHeader.h"; sourceTree = ""; }; - C7E3C604171842CA00489EE2 /* UIScrollView+APParallaxHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+APParallaxHeader.m"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - C72B5318171834E60093E24F /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 113BBD0A171B0A3800BC6574 /* QuartzCore.framework in Frameworks */, - C72B531F171834E60093E24F /* UIKit.framework in Frameworks */, - C72B5321171834E60093E24F /* Foundation.framework in Frameworks */, - C72B5323171834E60093E24F /* CoreGraphics.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - C72B5312171834E60093E24F = { - isa = PBXGroup; - children = ( - C7E3C602171842CA00489EE2 /* APParallaxHeader */, - C72B5324171834E60093E24F /* APParallaxHeaderDemo */, - C72B531D171834E60093E24F /* Frameworks */, - C72B531C171834E60093E24F /* Products */, - ); - sourceTree = ""; - }; - C72B531C171834E60093E24F /* Products */ = { - isa = PBXGroup; - children = ( - C72B531B171834E60093E24F /* APParallaxHeaderDemo.app */, - ); - name = Products; - sourceTree = ""; - }; - C72B531D171834E60093E24F /* Frameworks */ = { - isa = PBXGroup; - children = ( - 113BBD09171B0A3800BC6574 /* QuartzCore.framework */, - C72B531E171834E60093E24F /* UIKit.framework */, - C72B5320171834E60093E24F /* Foundation.framework */, - C72B5322171834E60093E24F /* CoreGraphics.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - C72B5324171834E60093E24F /* APParallaxHeaderDemo */ = { - isa = PBXGroup; - children = ( - C72B532D171834E60093E24F /* AppDelegate.h */, - C72B532E171834E60093E24F /* AppDelegate.m */, - C72B5336171834E60093E24F /* MainStoryboard.storyboard */, - C72B5339171834E60093E24F /* MasterViewController.h */, - C72B533A171834E60093E24F /* MasterViewController.m */, - C72B5325171834E60093E24F /* Supporting Files */, - ); - path = APParallaxHeaderDemo; - sourceTree = ""; - }; - C72B5325171834E60093E24F /* Supporting Files */ = { - isa = PBXGroup; - children = ( - A697F31E17A02B5F003B821D /* Rover.jpg */, - C7E3C5FE17183E4500489EE2 /* ParallaxImage.jpg */, - C72B5326171834E60093E24F /* APParallaxHeaderDemo-Info.plist */, - C72B5327171834E60093E24F /* InfoPlist.strings */, - C72B532A171834E60093E24F /* main.m */, - C72B532C171834E60093E24F /* APParallaxHeaderDemo-Prefix.pch */, - C72B5330171834E60093E24F /* Default.png */, - C72B5332171834E60093E24F /* Default@2x.png */, - C72B5334171834E60093E24F /* Default-568h@2x.png */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - C7E3C602171842CA00489EE2 /* APParallaxHeader */ = { - isa = PBXGroup; - children = ( - C7E3C603171842CA00489EE2 /* UIScrollView+APParallaxHeader.h */, - C7E3C604171842CA00489EE2 /* UIScrollView+APParallaxHeader.m */, - ); - name = APParallaxHeader; - path = ../APParallaxHeader; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - C72B531A171834E60093E24F /* APParallaxHeaderDemo */ = { - isa = PBXNativeTarget; - buildConfigurationList = C72B5341171834E60093E24F /* Build configuration list for PBXNativeTarget "APParallaxHeaderDemo" */; - buildPhases = ( - C72B5317171834E60093E24F /* Sources */, - C72B5318171834E60093E24F /* Frameworks */, - C72B5319171834E60093E24F /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = APParallaxHeaderDemo; - productName = APParallaxHeaderDemo; - productReference = C72B531B171834E60093E24F /* APParallaxHeaderDemo.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - C72B5313171834E60093E24F /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0460; - ORGANIZATIONNAME = "Apping AB"; - }; - buildConfigurationList = C72B5316171834E60093E24F /* Build configuration list for PBXProject "APParallaxHeaderDemo" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = C72B5312171834E60093E24F; - productRefGroup = C72B531C171834E60093E24F /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - C72B531A171834E60093E24F /* APParallaxHeaderDemo */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - C72B5319171834E60093E24F /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - C72B5329171834E60093E24F /* InfoPlist.strings in Resources */, - C72B5331171834E60093E24F /* Default.png in Resources */, - C72B5333171834E60093E24F /* Default@2x.png in Resources */, - C72B5335171834E60093E24F /* Default-568h@2x.png in Resources */, - C72B5338171834E60093E24F /* MainStoryboard.storyboard in Resources */, - C7E3C5FF17183E4500489EE2 /* ParallaxImage.jpg in Resources */, - A697F31F17A02B5F003B821D /* Rover.jpg in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - C72B5317171834E60093E24F /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - C72B532B171834E60093E24F /* main.m in Sources */, - C72B532F171834E60093E24F /* AppDelegate.m in Sources */, - C72B533B171834E60093E24F /* MasterViewController.m in Sources */, - C7E3C605171842CA00489EE2 /* UIScrollView+APParallaxHeader.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - C72B5327171834E60093E24F /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - C72B5328171834E60093E24F /* en */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - C72B5336171834E60093E24F /* MainStoryboard.storyboard */ = { - isa = PBXVariantGroup; - children = ( - C72B5337171834E60093E24F /* en */, - ); - name = MainStoryboard.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - C72B533F171834E60093E24F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - C72B5340171834E60093E24F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; - OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - C72B5342171834E60093E24F /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch"; - INFOPLIST_FILE = "APParallaxHeaderDemo/APParallaxHeaderDemo-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Debug; - }; - C72B5343171834E60093E24F /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch"; - INFOPLIST_FILE = "APParallaxHeaderDemo/APParallaxHeaderDemo-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; - PRODUCT_NAME = "$(TARGET_NAME)"; - WRAPPER_EXTENSION = app; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - C72B5316171834E60093E24F /* Build configuration list for PBXProject "APParallaxHeaderDemo" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C72B533F171834E60093E24F /* Debug */, - C72B5340171834E60093E24F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C72B5341171834E60093E24F /* Build configuration list for PBXNativeTarget "APParallaxHeaderDemo" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C72B5342171834E60093E24F /* Debug */, - C72B5343171834E60093E24F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = C72B5313171834E60093E24F /* Project object */; -} + + + + + archiveVersion + 1 + classes + + objectVersion + 46 + objects + + 113BBD09171B0A3800BC6574 + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + QuartzCore.framework + path + System/Library/Frameworks/QuartzCore.framework + sourceTree + SDKROOT + + 113BBD0A171B0A3800BC6574 + + fileRef + 113BBD09171B0A3800BC6574 + isa + PBXBuildFile + + 1487D1CF542146F8B5FBD373 + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods.a + sourceTree + BUILT_PRODUCTS_DIR + + 33C7148EE9E84A53A509D6DB + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + name + Pods.xcconfig + path + Pods/Pods.xcconfig + sourceTree + <group> + + 568854A15E5F4916BDBE8BB9 + + buildActionMask + 2147483647 + files + + inputPaths + + isa + PBXShellScriptBuildPhase + name + Copy Pods Resources + outputPaths + + runOnlyForDeploymentPostprocessing + 0 + shellPath + /bin/sh + shellScript + "${SRCROOT}/Pods/Pods-resources.sh" + + showEnvVarsInLog + 0 + + A697F31E17A02B5F003B821D + + isa + PBXFileReference + lastKnownFileType + image.jpeg + path + Rover.jpg + sourceTree + <group> + + A697F31F17A02B5F003B821D + + fileRef + A697F31E17A02B5F003B821D + isa + PBXBuildFile + + B0447B6A324D4235B356036E + + fileRef + 1487D1CF542146F8B5FBD373 + isa + PBXBuildFile + + C72B5312171834E60093E24F + + children + + C7E3C602171842CA00489EE2 + C72B5324171834E60093E24F + C72B531D171834E60093E24F + C72B531C171834E60093E24F + 33C7148EE9E84A53A509D6DB + + isa + PBXGroup + sourceTree + <group> + + C72B5313171834E60093E24F + + attributes + + LastUpgradeCheck + 0460 + ORGANIZATIONNAME + Apping AB + TargetAttributes + + C72B531A171834E60093E24F + + DevelopmentTeam + V98K4C44UG + + + + buildConfigurationList + C72B5316171834E60093E24F + compatibilityVersion + Xcode 3.2 + developmentRegion + English + hasScannedForEncodings + 0 + isa + PBXProject + knownRegions + + en + + mainGroup + C72B5312171834E60093E24F + productRefGroup + C72B531C171834E60093E24F + projectDirPath + + projectReferences + + projectRoot + + targets + + C72B531A171834E60093E24F + + + C72B5316171834E60093E24F + + buildConfigurations + + C72B533F171834E60093E24F + C72B5340171834E60093E24F + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + C72B5317171834E60093E24F + + buildActionMask + 2147483647 + files + + C72B532B171834E60093E24F + C72B532F171834E60093E24F + C72B533B171834E60093E24F + C7E3C605171842CA00489EE2 + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + C72B5318171834E60093E24F + + buildActionMask + 2147483647 + files + + 113BBD0A171B0A3800BC6574 + C72B531F171834E60093E24F + C72B5321171834E60093E24F + C72B5323171834E60093E24F + B0447B6A324D4235B356036E + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + C72B5319171834E60093E24F + + buildActionMask + 2147483647 + files + + C72B5329171834E60093E24F + C72B5331171834E60093E24F + C72B5333171834E60093E24F + C72B5335171834E60093E24F + C72B5338171834E60093E24F + C7E3C5FF17183E4500489EE2 + A697F31F17A02B5F003B821D + + isa + PBXResourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + C72B531A171834E60093E24F + + buildConfigurationList + C72B5341171834E60093E24F + buildPhases + + EC203B1DF10846C5936DC33A + C72B5317171834E60093E24F + C72B5318171834E60093E24F + C72B5319171834E60093E24F + 568854A15E5F4916BDBE8BB9 + + buildRules + + dependencies + + isa + PBXNativeTarget + name + APParallaxHeaderDemo + productName + APParallaxHeaderDemo + productReference + C72B531B171834E60093E24F + productType + com.apple.product-type.application + + C72B531B171834E60093E24F + + explicitFileType + wrapper.application + includeInIndex + 0 + isa + PBXFileReference + path + APParallaxHeaderDemo.app + sourceTree + BUILT_PRODUCTS_DIR + + C72B531C171834E60093E24F + + children + + C72B531B171834E60093E24F + + isa + PBXGroup + name + Products + sourceTree + <group> + + C72B531D171834E60093E24F + + children + + 113BBD09171B0A3800BC6574 + C72B531E171834E60093E24F + C72B5320171834E60093E24F + C72B5322171834E60093E24F + 1487D1CF542146F8B5FBD373 + + isa + PBXGroup + name + Frameworks + sourceTree + <group> + + C72B531E171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + UIKit.framework + path + System/Library/Frameworks/UIKit.framework + sourceTree + SDKROOT + + C72B531F171834E60093E24F + + fileRef + C72B531E171834E60093E24F + isa + PBXBuildFile + + C72B5320171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + Foundation.framework + path + System/Library/Frameworks/Foundation.framework + sourceTree + SDKROOT + + C72B5321171834E60093E24F + + fileRef + C72B5320171834E60093E24F + isa + PBXBuildFile + + C72B5322171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + CoreGraphics.framework + path + System/Library/Frameworks/CoreGraphics.framework + sourceTree + SDKROOT + + C72B5323171834E60093E24F + + fileRef + C72B5322171834E60093E24F + isa + PBXBuildFile + + C72B5324171834E60093E24F + + children + + C72B532D171834E60093E24F + C72B532E171834E60093E24F + C72B5336171834E60093E24F + C72B5339171834E60093E24F + C72B533A171834E60093E24F + C72B5325171834E60093E24F + + isa + PBXGroup + path + APParallaxHeaderDemo + sourceTree + <group> + + C72B5325171834E60093E24F + + children + + A697F31E17A02B5F003B821D + C7E3C5FE17183E4500489EE2 + C72B5326171834E60093E24F + C72B5327171834E60093E24F + C72B532A171834E60093E24F + C72B532C171834E60093E24F + C72B5330171834E60093E24F + C72B5332171834E60093E24F + C72B5334171834E60093E24F + + isa + PBXGroup + name + Supporting Files + sourceTree + <group> + + C72B5326171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + text.plist.xml + path + APParallaxHeaderDemo-Info.plist + sourceTree + <group> + + C72B5327171834E60093E24F + + children + + C72B5328171834E60093E24F + + isa + PBXVariantGroup + name + InfoPlist.strings + sourceTree + <group> + + C72B5328171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + text.plist.strings + name + en + path + en.lproj/InfoPlist.strings + sourceTree + <group> + + C72B5329171834E60093E24F + + fileRef + C72B5327171834E60093E24F + isa + PBXBuildFile + + C72B532A171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + main.m + sourceTree + <group> + + C72B532B171834E60093E24F + + fileRef + C72B532A171834E60093E24F + isa + PBXBuildFile + + C72B532C171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + APParallaxHeaderDemo-Prefix.pch + sourceTree + <group> + + C72B532D171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + AppDelegate.h + sourceTree + <group> + + C72B532E171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + AppDelegate.m + sourceTree + <group> + + C72B532F171834E60093E24F + + fileRef + C72B532E171834E60093E24F + isa + PBXBuildFile + + C72B5330171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + image.png + path + Default.png + sourceTree + <group> + + C72B5331171834E60093E24F + + fileRef + C72B5330171834E60093E24F + isa + PBXBuildFile + + C72B5332171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + image.png + path + Default@2x.png + sourceTree + <group> + + C72B5333171834E60093E24F + + fileRef + C72B5332171834E60093E24F + isa + PBXBuildFile + + C72B5334171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + image.png + path + Default-568h@2x.png + sourceTree + <group> + + C72B5335171834E60093E24F + + fileRef + C72B5334171834E60093E24F + isa + PBXBuildFile + + C72B5336171834E60093E24F + + children + + C72B5337171834E60093E24F + + isa + PBXVariantGroup + name + MainStoryboard.storyboard + sourceTree + <group> + + C72B5337171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + file.storyboard + name + en + path + en.lproj/MainStoryboard.storyboard + sourceTree + <group> + + C72B5338171834E60093E24F + + fileRef + C72B5336171834E60093E24F + isa + PBXBuildFile + + C72B5339171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + MasterViewController.h + sourceTree + <group> + + C72B533A171834E60093E24F + + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + MasterViewController.m + sourceTree + <group> + + C72B533B171834E60093E24F + + fileRef + C72B533A171834E60093E24F + isa + PBXBuildFile + + C72B533F171834E60093E24F + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_OBJC_ARC + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN__DUPLICATE_METHOD_MATCH + YES + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + COPY_PHASE_STRIP + NO + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + GCC_WARN_ABOUT_RETURN_TYPE + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 6.1 + ONLY_ACTIVE_ARCH + YES + SDKROOT + iphoneos + + isa + XCBuildConfiguration + name + Debug + + C72B5340171834E60093E24F + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_OBJC_ARC + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN__DUPLICATE_METHOD_MATCH + YES + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + COPY_PHASE_STRIP + YES + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_WARN_ABOUT_RETURN_TYPE + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 6.1 + OTHER_CFLAGS + -DNS_BLOCK_ASSERTIONS=1 + SDKROOT + iphoneos + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + C72B5341171834E60093E24F + + buildConfigurations + + C72B5342171834E60093E24F + C72B5343171834E60093E24F + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + C72B5342171834E60093E24F + + baseConfigurationReference + 33C7148EE9E84A53A509D6DB + buildSettings + + CODE_SIGN_IDENTITY + iPhone Developer + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch + INFOPLIST_FILE + APParallaxHeaderDemo/APParallaxHeaderDemo-Info.plist + IPHONEOS_DEPLOYMENT_TARGET + 6.1 + PRODUCT_NAME + $(TARGET_NAME) + PROVISIONING_PROFILE + + WRAPPER_EXTENSION + app + + isa + XCBuildConfiguration + name + Debug + + C72B5343171834E60093E24F + + baseConfigurationReference + 33C7148EE9E84A53A509D6DB + buildSettings + + CODE_SIGN_IDENTITY + iPhone Developer + CODE_SIGN_IDENTITY[sdk=iphoneos*] + iPhone Developer + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch + INFOPLIST_FILE + APParallaxHeaderDemo/APParallaxHeaderDemo-Info.plist + IPHONEOS_DEPLOYMENT_TARGET + 6.1 + PRODUCT_NAME + $(TARGET_NAME) + PROVISIONING_PROFILE + + WRAPPER_EXTENSION + app + + isa + XCBuildConfiguration + name + Release + + C7E3C5FE17183E4500489EE2 + + isa + PBXFileReference + lastKnownFileType + image.jpeg + path + ParallaxImage.jpg + sourceTree + <group> + + C7E3C5FF17183E4500489EE2 + + fileRef + C7E3C5FE17183E4500489EE2 + isa + PBXBuildFile + + C7E3C602171842CA00489EE2 + + children + + C7E3C603171842CA00489EE2 + C7E3C604171842CA00489EE2 + + isa + PBXGroup + name + APParallaxHeader + path + ../APParallaxHeader + sourceTree + <group> + + C7E3C603171842CA00489EE2 + + fileEncoding + 4 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + UIScrollView+APParallaxHeader.h + sourceTree + <group> + + C7E3C604171842CA00489EE2 + + fileEncoding + 4 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + UIScrollView+APParallaxHeader.m + sourceTree + <group> + + C7E3C605171842CA00489EE2 + + fileRef + C7E3C604171842CA00489EE2 + isa + PBXBuildFile + + EC203B1DF10846C5936DC33A + + buildActionMask + 2147483647 + files + + inputPaths + + isa + PBXShellScriptBuildPhase + name + Check Pods Manifest.lock + outputPaths + + runOnlyForDeploymentPostprocessing + 0 + shellPath + /bin/sh + shellScript + diff "${PODS_ROOT}/../Podfile.lock" "${PODS_ROOT}/Manifest.lock" > /dev/null +if [[ $? != 0 ]] ; then + cat << EOM +error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation. +EOM + exit 1 +fi + + showEnvVarsInLog + 0 + + + rootObject + C72B5313171834E60093E24F + + diff --git a/Demo/APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch b/Demo/APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch index 41ecb3c..8e93001 100644 --- a/Demo/APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch +++ b/Demo/APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch @@ -11,4 +11,6 @@ #ifdef __OBJC__ #import #import + +#import #endif diff --git a/Demo/APParallaxHeaderDemo/MasterViewController.m b/Demo/APParallaxHeaderDemo/MasterViewController.m index 4cf0779..122ec11 100644 --- a/Demo/APParallaxHeaderDemo/MasterViewController.m +++ b/Demo/APParallaxHeaderDemo/MasterViewController.m @@ -9,6 +9,8 @@ #import "MasterViewController.h" #import "UIScrollView+APParallaxHeader.h" +#define PARALLAX_HEIGHT 320 + @interface MasterViewController () { BOOL parallaxWithView; } @@ -21,6 +23,11 @@ - (void)viewDidLoad { UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithTitle:@"with view" style:UIBarButtonItemStylePlain target:self action:@selector(toggle:)]; [self.navigationItem setRightBarButtonItem:barButton]; + + [self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor] size:CGSizeMake(200, 200)] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault]; + [self.navigationController.navigationBar setShadowImage:[UIImage new]]; + + self.automaticallyAdjustsScrollViewInsets = NO; [self toggle:nil]; } @@ -33,9 +40,9 @@ - (void)toggle:(id)sender { if(parallaxWithView == NO) { // add parallax with view UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Rover.jpg"]]; - [imageView setFrame:CGRectMake(0, 0, 320, 160)]; + [imageView setFrame:CGRectMake(0, 0, 320, PARALLAX_HEIGHT)]; [imageView setContentMode:UIViewContentModeScaleAspectFill]; - [self.tableView addParallaxWithView:imageView andHeight:160]; + [self.tableView addParallaxWithView:imageView andHeight:PARALLAX_HEIGHT]; parallaxWithView = YES; // Update the toggle button @@ -44,7 +51,7 @@ - (void)toggle:(id)sender { } else { // add parallax with image - [self.tableView addParallaxWithImage:[UIImage imageNamed:@"ParallaxImage.jpg"] andHeight:160]; + [self.tableView addParallaxWithImage:[UIImage imageNamed:@"ParallaxImage.jpg"] andHeight:PARALLAX_HEIGHT]; parallaxWithView = NO; // Update the toggle button @@ -74,7 +81,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; - cell.textLabel.text = [NSString stringWithFormat:@"Row %i", indexPath.row+1]; + cell.textLabel.text = [NSString stringWithFormat:@"Row %li", indexPath.row+1]; return cell; } diff --git a/Demo/APParallaxHeaderDemo/en.lproj/MainStoryboard.storyboard b/Demo/APParallaxHeaderDemo/en.lproj/MainStoryboard.storyboard index e2cdc06..395d1c6 100644 --- a/Demo/APParallaxHeaderDemo/en.lproj/MainStoryboard.storyboard +++ b/Demo/APParallaxHeaderDemo/en.lproj/MainStoryboard.storyboard @@ -1,7 +1,9 @@ - + - + + + @@ -20,19 +22,19 @@ - + - - - + + + - + - + @@ -44,8 +46,7 @@ - - + @@ -55,6 +56,7 @@ + @@ -62,14 +64,12 @@ - - - - - - + + + + - \ No newline at end of file + diff --git a/Demo/Podfile b/Demo/Podfile new file mode 100644 index 0000000..d22df99 --- /dev/null +++ b/Demo/Podfile @@ -0,0 +1,4 @@ +# Uncomment this line to define a global platform for your project +platform :ios, "7.0" + +pod 'UIImage+Additions' diff --git a/Demo/Podfile.lock b/Demo/Podfile.lock new file mode 100644 index 0000000..096e562 --- /dev/null +++ b/Demo/Podfile.lock @@ -0,0 +1,10 @@ +PODS: + - UIImage+Additions (1.1.0) + +DEPENDENCIES: + - UIImage+Additions + +SPEC CHECKSUMS: + UIImage+Additions: 66ee88773215955a2703ea31b790fdf3438303d9 + +COCOAPODS: 0.33.1 diff --git a/Demo/Pods/BuildHeaders/UIImage+Additions/UIImage+Additions.h b/Demo/Pods/BuildHeaders/UIImage+Additions/UIImage+Additions.h new file mode 120000 index 0000000..091c642 --- /dev/null +++ b/Demo/Pods/BuildHeaders/UIImage+Additions/UIImage+Additions.h @@ -0,0 +1 @@ +../../UIImage+Additions/UIImage+Additions.h \ No newline at end of file diff --git a/Demo/Pods/Headers/UIImage+Additions/UIImage+Additions.h b/Demo/Pods/Headers/UIImage+Additions/UIImage+Additions.h new file mode 120000 index 0000000..091c642 --- /dev/null +++ b/Demo/Pods/Headers/UIImage+Additions/UIImage+Additions.h @@ -0,0 +1 @@ +../../UIImage+Additions/UIImage+Additions.h \ No newline at end of file diff --git a/Demo/Pods/Manifest.lock b/Demo/Pods/Manifest.lock new file mode 100644 index 0000000..096e562 --- /dev/null +++ b/Demo/Pods/Manifest.lock @@ -0,0 +1,10 @@ +PODS: + - UIImage+Additions (1.1.0) + +DEPENDENCIES: + - UIImage+Additions + +SPEC CHECKSUMS: + UIImage+Additions: 66ee88773215955a2703ea31b790fdf3438303d9 + +COCOAPODS: 0.33.1 diff --git a/Demo/Pods/Pods-UIImage+Additions-Private.xcconfig b/Demo/Pods/Pods-UIImage+Additions-Private.xcconfig new file mode 100644 index 0000000..d8c98bb --- /dev/null +++ b/Demo/Pods/Pods-UIImage+Additions-Private.xcconfig @@ -0,0 +1,5 @@ +#include "Pods-UIImage+Additions.xcconfig" +GCC_PREPROCESSOR_DEFINITIONS = COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/UIImage+Additions" "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/UIImage+Additions" +OTHER_LDFLAGS = -ObjC ${PODS_UIIMAGE_ADDITIONS_OTHER_LDFLAGS} +PODS_ROOT = ${SRCROOT} \ No newline at end of file diff --git a/Demo/Pods/Pods-UIImage+Additions-dummy.m b/Demo/Pods/Pods-UIImage+Additions-dummy.m new file mode 100644 index 0000000..0a41f0d --- /dev/null +++ b/Demo/Pods/Pods-UIImage+Additions-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_UIImage_Additions : NSObject +@end +@implementation PodsDummy_Pods_UIImage_Additions +@end diff --git a/Demo/Pods/Pods-UIImage+Additions-prefix.pch b/Demo/Pods/Pods-UIImage+Additions-prefix.pch new file mode 100644 index 0000000..95cf11d --- /dev/null +++ b/Demo/Pods/Pods-UIImage+Additions-prefix.pch @@ -0,0 +1,5 @@ +#ifdef __OBJC__ +#import +#endif + +#import "Pods-environment.h" diff --git a/Demo/Pods/Pods-UIImage+Additions.xcconfig b/Demo/Pods/Pods-UIImage+Additions.xcconfig new file mode 100644 index 0000000..3a05cad --- /dev/null +++ b/Demo/Pods/Pods-UIImage+Additions.xcconfig @@ -0,0 +1 @@ +PODS_UIIMAGE_ADDITIONS_OTHER_LDFLAGS = -framework UIKit \ No newline at end of file diff --git a/Demo/Pods/Pods-acknowledgements.markdown b/Demo/Pods/Pods-acknowledgements.markdown new file mode 100644 index 0000000..0aa6cb5 --- /dev/null +++ b/Demo/Pods/Pods-acknowledgements.markdown @@ -0,0 +1,13 @@ +# Acknowledgements +This application makes use of the following third party libraries: + +## UIImage+Additions + +Copyright (c) 2013 Joan Martin, vilanovi@gmail.com. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE +Generated by CocoaPods - http://cocoapods.org diff --git a/Demo/Pods/Pods-acknowledgements.plist b/Demo/Pods/Pods-acknowledgements.plist new file mode 100644 index 0000000..f9d6415 --- /dev/null +++ b/Demo/Pods/Pods-acknowledgements.plist @@ -0,0 +1,43 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + Copyright (c) 2013 Joan Martin, vilanovi@gmail.com. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE + Title + UIImage+Additions + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - http://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/Demo/Pods/Pods-dummy.m b/Demo/Pods/Pods-dummy.m new file mode 100644 index 0000000..ade64bd --- /dev/null +++ b/Demo/Pods/Pods-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods : NSObject +@end +@implementation PodsDummy_Pods +@end diff --git a/Demo/Pods/Pods-environment.h b/Demo/Pods/Pods-environment.h new file mode 100644 index 0000000..a6798f2 --- /dev/null +++ b/Demo/Pods/Pods-environment.h @@ -0,0 +1,14 @@ + +// To check if a library is compiled with CocoaPods you +// can use the `COCOAPODS` macro definition which is +// defined in the xcconfigs so it is available in +// headers also when they are imported in the client +// project. + + +// UIImage+Additions +#define COCOAPODS_POD_AVAILABLE_UIImage_Additions +#define COCOAPODS_VERSION_MAJOR_UIImage_Additions 1 +#define COCOAPODS_VERSION_MINOR_UIImage_Additions 1 +#define COCOAPODS_VERSION_PATCH_UIImage_Additions 0 + diff --git a/Demo/Pods/Pods-resources.sh b/Demo/Pods/Pods-resources.sh new file mode 100755 index 0000000..39c2549 --- /dev/null +++ b/Demo/Pods/Pods-resources.sh @@ -0,0 +1,68 @@ +#!/bin/sh +set -e + +RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt +> "$RESOURCES_TO_COPY" + +install_resource() +{ + case $1 in + *.storyboard) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.xib) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.framework) + echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + ;; + *.xcdatamodel) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" + ;; + *.xcdatamodeld) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" + ;; + *.xcassets) + ;; + /*) + echo "$1" + echo "$1" >> "$RESOURCES_TO_COPY" + ;; + *) + echo "${PODS_ROOT}/$1" + echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" + ;; + esac +} + +rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +if [[ "${ACTION}" == "install" ]]; then + rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi +rm -f "$RESOURCES_TO_COPY" + +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ `xcrun --find actool` ] && [ `find . -name '*.xcassets' | wc -l` -ne 0 ] +then + case "${TARGETED_DEVICE_FAMILY}" in + 1,2) + TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" + ;; + 1) + TARGET_DEVICE_ARGS="--target-device iphone" + ;; + 2) + TARGET_DEVICE_ARGS="--target-device ipad" + ;; + *) + TARGET_DEVICE_ARGS="--target-device mac" + ;; + esac + find "${PWD}" -name "*.xcassets" -print0 | xargs -0 actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi diff --git a/Demo/Pods/Pods.xcconfig b/Demo/Pods/Pods.xcconfig new file mode 100644 index 0000000..200e653 --- /dev/null +++ b/Demo/Pods/Pods.xcconfig @@ -0,0 +1,5 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/UIImage+Additions" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers" -isystem "${PODS_ROOT}/Headers/UIImage+Additions" +OTHER_LDFLAGS = -ObjC -framework UIKit +PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/Demo/Pods/Pods.xcodeproj/project.pbxproj b/Demo/Pods/Pods.xcodeproj/project.pbxproj new file mode 100644 index 0000000..2283b1e --- /dev/null +++ b/Demo/Pods/Pods.xcodeproj/project.pbxproj @@ -0,0 +1,983 @@ + + + + + archiveVersion + 1 + classes + + objectVersion + 46 + objects + + 05E590EBE2674D74BA7E246F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + Pods-UIImage+Additions-prefix.pch + sourceTree + <group> + + 089F9A3059BD4039A3FDC192 + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + Foundation.framework + path + Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/Foundation.framework + sourceTree + DEVELOPER_DIR + + 19EDCEE99E4A45859F0D7EF1 + + fileRef + E7F80DC0E488405C871C43B9 + isa + PBXBuildFile + + 1A2F54E814D944E78038CB2F + + fileRef + 089F9A3059BD4039A3FDC192 + isa + PBXBuildFile + + 255D5BAC53C444ED94966621 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text + name + Podfile + path + ../Podfile + sourceTree + SOURCE_ROOT + xcLanguageSpecificationIdentifier + xcode.lang.ruby + + 2BCA69A906E54822819CE6DD + + buildActionMask + 2147483647 + files + + 1A2F54E814D944E78038CB2F + 19EDCEE99E4A45859F0D7EF1 + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 2F5436B6114D4A51904101FF + + buildConfigurations + + 5371B2225A0943E78A2A03A2 + E1A6817C7BAA4CB3BA117D31 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 2FE3CDA18FCE4451B59BA1AD + + isa + PBXTargetDependency + target + 4C702387862B463696C41A25 + targetProxy + 5C8F94F2170C4ED6BF6752A9 + + 327B3DA2FA754F019EF80E7C + + buildConfigurations + + E93AF7B2CF8C4946B22C7666 + DD039611EEFE4EC2B761389B + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 3539C68A6FA6497B887132A5 + + fileRef + 089F9A3059BD4039A3FDC192 + isa + PBXBuildFile + + 4A9CD423C4FB4544AAE0F610 + + buildActionMask + 2147483647 + files + + B1D601AEA45D4E54925EF9DF + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 4BA355968C3F470F8188C603 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text + path + Pods-acknowledgements.markdown + sourceTree + <group> + + 4C702387862B463696C41A25 + + buildConfigurationList + 5B876EE27A19430CA5AA2759 + buildPhases + + 70A7044809F74A90863C56C3 + CA1612547FD54038B3ADE2C8 + E0D4634C27354B25AF3F0DE4 + + buildRules + + dependencies + + isa + PBXNativeTarget + name + Pods-UIImage+Additions + productName + Pods-UIImage+Additions + productReference + E7F80DC0E488405C871C43B9 + productType + com.apple.product-type.library.static + + 4DD7E9A876094AF79959798D + + children + + B9CA4D4E922F4E1CB16854C3 + + isa + PBXGroup + name + Targets Support Files + sourceTree + <group> + + 5371B2225A0943E78A2A03A2 + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_MODULES + YES + CLANG_ENABLE_OBJC_ARC + NO + CLANG_WARN_BOOL_CONVERSION + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_DIRECT_OBJC_ISA_USAGE + YES + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN_OBJC_ROOT_CLASS + YES + COPY_PHASE_STRIP + YES + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + GCC_WARN_64_TO_32_BIT_CONVERSION + YES + GCC_WARN_ABOUT_RETURN_TYPE + YES + GCC_WARN_UNDECLARED_SELECTOR + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES + GCC_WARN_UNUSED_FUNCTION + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 7.0 + ONLY_ACTIVE_ARCH + YES + STRIP_INSTALLED_PRODUCT + NO + + isa + XCBuildConfiguration + name + Debug + + 5B876EE27A19430CA5AA2759 + + buildConfigurations + + 855BF7A33B9E42D6B37E8B56 + AE97BF7DE7414D60A3C39943 + + defaultConfigurationIsVisible + 0 + defaultConfigurationName + Release + isa + XCConfigurationList + + 5C8F94F2170C4ED6BF6752A9 + + containerPortal + 714913E2D52D4AE7AE6382F9 + isa + PBXContainerItemProxy + proxyType + 1 + remoteGlobalIDString + 4C702387862B463696C41A25 + remoteInfo + Pods-UIImage+Additions + + 696EEFBC26E7405EAAE9060A + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + Pods-UIImage+Additions-dummy.m + sourceTree + <group> + + 6A99D4A089054418B3DB8D87 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.script.sh + path + Pods-resources.sh + sourceTree + <group> + + 70A7044809F74A90863C56C3 + + buildActionMask + 2147483647 + files + + 91FF5E9F90A542DF87CE43C7 + CF9AA1195B1141B69AA56771 + + isa + PBXSourcesBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + 714913E2D52D4AE7AE6382F9 + + attributes + + LastUpgradeCheck + 0510 + + buildConfigurationList + 2F5436B6114D4A51904101FF + compatibilityVersion + Xcode 3.2 + developmentRegion + English + hasScannedForEncodings + 0 + isa + PBXProject + knownRegions + + en + + mainGroup + B7C3134C6B0E4E788AC19898 + productRefGroup + D5F3823FEFA444599DCC7C29 + projectDirPath + + projectReferences + + projectRoot + + targets + + F98DD63335A447FA8471D243 + 4C702387862B463696C41A25 + + + 855BF7A33B9E42D6B37E8B56 + + baseConfigurationReference + A3AFD85501534C77B1E61841 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + NO + DSTROOT + /tmp/xcodeproj.dst + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + Pods-UIImage+Additions-prefix.pch + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + GCC_VERSION + com.apple.compilers.llvm.clang.1_0 + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 7.0 + OTHER_LDFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + + isa + XCBuildConfiguration + name + Debug + + 86BA4B07DA03461EA6B06671 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + UIImage+Additions.h + sourceTree + <group> + + 8B487A05B73C439BA397AC9B + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + UIImage+Additions.m + sourceTree + <group> + + 91FF5E9F90A542DF87CE43C7 + + fileRef + 696EEFBC26E7405EAAE9060A + isa + PBXBuildFile + + 92AAAF138D9749E6ABE0D686 + + children + + 089F9A3059BD4039A3FDC192 + B7D26A45E919456CB10D75A4 + + isa + PBXGroup + name + iOS + sourceTree + <group> + + A3AFD85501534C77B1E61841 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods-UIImage+Additions-Private.xcconfig + sourceTree + <group> + + A892014D434943CC9596B03D + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.plist.xml + path + Pods-acknowledgements.plist + sourceTree + <group> + + AE97BF7DE7414D60A3C39943 + + baseConfigurationReference + A3AFD85501534C77B1E61841 + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + YES + DSTROOT + /tmp/xcodeproj.dst + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREFIX_HEADER + Pods-UIImage+Additions-prefix.pch + GCC_VERSION + com.apple.compilers.llvm.clang.1_0 + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 7.0 + OTHER_CFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_CPLUSPLUSFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_LDFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + B0144C2421F7438C9DA1D2C7 + + children + + 86BA4B07DA03461EA6B06671 + 8B487A05B73C439BA397AC9B + F7E86A5B64E843E09D7C78B0 + + isa + PBXGroup + name + UIImage+Additions + path + UIImage+Additions + sourceTree + <group> + + B184ADE50F9E4AD981FC9F95 + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods.a + sourceTree + BUILT_PRODUCTS_DIR + + B1D601AEA45D4E54925EF9DF + + fileRef + BE2D37DC8EAB47C59E1AB12F + isa + PBXBuildFile + + B7C3134C6B0E4E788AC19898 + + children + + 255D5BAC53C444ED94966621 + DC25B90EFC12459C89ED7DDF + E8135ADD8AFC4D0E86BDBFB7 + D5F3823FEFA444599DCC7C29 + 4DD7E9A876094AF79959798D + + isa + PBXGroup + sourceTree + <group> + + B7D26A45E919456CB10D75A4 + + isa + PBXFileReference + lastKnownFileType + wrapper.framework + name + UIKit.framework + path + Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/System/Library/Frameworks/UIKit.framework + sourceTree + DEVELOPER_DIR + + B9CA4D4E922F4E1CB16854C3 + + children + + FE80436EB4B54915891C9E5C + 4BA355968C3F470F8188C603 + A892014D434943CC9596B03D + BE2D37DC8EAB47C59E1AB12F + E0FBF68A2DF346B1BD3CC114 + 6A99D4A089054418B3DB8D87 + + isa + PBXGroup + name + Pods + sourceTree + <group> + + BA063C0735934D368F400446 + + fileRef + B7D26A45E919456CB10D75A4 + isa + PBXBuildFile + + BB9A74CF6F7249E585E2BC45 + + fileRef + 86BA4B07DA03461EA6B06671 + isa + PBXBuildFile + + BE2D37DC8EAB47C59E1AB12F + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.objc + path + Pods-dummy.m + sourceTree + <group> + + BFCF55EE12EF4EABA5C83AEB + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods-UIImage+Additions.xcconfig + sourceTree + <group> + + CA1612547FD54038B3ADE2C8 + + buildActionMask + 2147483647 + files + + 3539C68A6FA6497B887132A5 + BA063C0735934D368F400446 + + isa + PBXFrameworksBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + CF9AA1195B1141B69AA56771 + + fileRef + 8B487A05B73C439BA397AC9B + isa + PBXBuildFile + settings + + COMPILER_FLAGS + -fobjc-arc -DOS_OBJECT_USE_OBJC=0 + + + D5F3823FEFA444599DCC7C29 + + children + + B184ADE50F9E4AD981FC9F95 + E7F80DC0E488405C871C43B9 + + isa + PBXGroup + name + Products + sourceTree + <group> + + DC25B90EFC12459C89ED7DDF + + children + + 92AAAF138D9749E6ABE0D686 + + isa + PBXGroup + name + Frameworks + sourceTree + <group> + + DD039611EEFE4EC2B761389B + + baseConfigurationReference + FE80436EB4B54915891C9E5C + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + YES + DSTROOT + /tmp/xcodeproj.dst + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_VERSION + com.apple.compilers.llvm.clang.1_0 + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 7.0 + OTHER_CFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_CPLUSPLUSFLAGS + + -DNS_BLOCK_ASSERTIONS=1 + $(inherited) + + OTHER_LDFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + E0D4634C27354B25AF3F0DE4 + + buildActionMask + 2147483647 + files + + BB9A74CF6F7249E585E2BC45 + + isa + PBXHeadersBuildPhase + runOnlyForDeploymentPostprocessing + 0 + + E0FBF68A2DF346B1BD3CC114 + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + sourcecode.c.h + path + Pods-environment.h + sourceTree + <group> + + E1A6817C7BAA4CB3BA117D31 + + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + CLANG_CXX_LANGUAGE_STANDARD + gnu++0x + CLANG_CXX_LIBRARY + libc++ + CLANG_ENABLE_MODULES + YES + CLANG_ENABLE_OBJC_ARC + NO + CLANG_WARN_BOOL_CONVERSION + YES + CLANG_WARN_CONSTANT_CONVERSION + YES + CLANG_WARN_DIRECT_OBJC_ISA_USAGE + YES + CLANG_WARN_EMPTY_BODY + YES + CLANG_WARN_ENUM_CONVERSION + YES + CLANG_WARN_INT_CONVERSION + YES + CLANG_WARN_OBJC_ROOT_CLASS + YES + COPY_PHASE_STRIP + NO + ENABLE_NS_ASSERTIONS + NO + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_WARN_64_TO_32_BIT_CONVERSION + YES + GCC_WARN_ABOUT_RETURN_TYPE + YES + GCC_WARN_UNDECLARED_SELECTOR + YES + GCC_WARN_UNINITIALIZED_AUTOS + YES + GCC_WARN_UNUSED_FUNCTION + YES + GCC_WARN_UNUSED_VARIABLE + YES + IPHONEOS_DEPLOYMENT_TARGET + 7.0 + STRIP_INSTALLED_PRODUCT + NO + VALIDATE_PRODUCT + YES + + isa + XCBuildConfiguration + name + Release + + E7F80DC0E488405C871C43B9 + + explicitFileType + archive.ar + includeInIndex + 0 + isa + PBXFileReference + path + libPods-UIImage+Additions.a + sourceTree + BUILT_PRODUCTS_DIR + + E8135ADD8AFC4D0E86BDBFB7 + + children + + B0144C2421F7438C9DA1D2C7 + + isa + PBXGroup + name + Pods + sourceTree + <group> + + E93AF7B2CF8C4946B22C7666 + + baseConfigurationReference + FE80436EB4B54915891C9E5C + buildSettings + + ALWAYS_SEARCH_USER_PATHS + NO + COPY_PHASE_STRIP + NO + DSTROOT + /tmp/xcodeproj.dst + GCC_C_LANGUAGE_STANDARD + gnu99 + GCC_DYNAMIC_NO_PIC + NO + GCC_OPTIMIZATION_LEVEL + 0 + GCC_PRECOMPILE_PREFIX_HEADER + YES + GCC_PREPROCESSOR_DEFINITIONS + + DEBUG=1 + $(inherited) + + GCC_SYMBOLS_PRIVATE_EXTERN + NO + GCC_VERSION + com.apple.compilers.llvm.clang.1_0 + INSTALL_PATH + $(BUILT_PRODUCTS_DIR) + IPHONEOS_DEPLOYMENT_TARGET + 7.0 + OTHER_LDFLAGS + + PRODUCT_NAME + $(TARGET_NAME) + PUBLIC_HEADERS_FOLDER_PATH + $(TARGET_NAME) + SDKROOT + iphoneos + SKIP_INSTALL + YES + + isa + XCBuildConfiguration + name + Debug + + F7E86A5B64E843E09D7C78B0 + + children + + BFCF55EE12EF4EABA5C83AEB + A3AFD85501534C77B1E61841 + 696EEFBC26E7405EAAE9060A + 05E590EBE2674D74BA7E246F + + isa + PBXGroup + name + Support Files + sourceTree + SOURCE_ROOT + + F98DD63335A447FA8471D243 + + buildConfigurationList + 327B3DA2FA754F019EF80E7C + buildPhases + + 4A9CD423C4FB4544AAE0F610 + 2BCA69A906E54822819CE6DD + + buildRules + + dependencies + + 2FE3CDA18FCE4451B59BA1AD + + isa + PBXNativeTarget + name + Pods + productName + Pods + productReference + B184ADE50F9E4AD981FC9F95 + productType + com.apple.product-type.library.static + + FE80436EB4B54915891C9E5C + + includeInIndex + 1 + isa + PBXFileReference + lastKnownFileType + text.xcconfig + path + Pods.xcconfig + sourceTree + <group> + + + rootObject + 714913E2D52D4AE7AE6382F9 + + diff --git a/Demo/Pods/UIImage+Additions/LICENSE.txt b/Demo/Pods/UIImage+Additions/LICENSE.txt new file mode 100644 index 0000000..fccff84 --- /dev/null +++ b/Demo/Pods/UIImage+Additions/LICENSE.txt @@ -0,0 +1,7 @@ +Copyright (c) 2013 Joan Martin, vilanovi@gmail.com. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE \ No newline at end of file diff --git a/Demo/Pods/UIImage+Additions/README.md b/Demo/Pods/UIImage+Additions/README.md new file mode 100644 index 0000000..eec4f8e --- /dev/null +++ b/Demo/Pods/UIImage+Additions/README.md @@ -0,0 +1,81 @@ +UIImage-Additions +================= + +This category of UIImage add methods to generate dynamically images from colors, adding corner radius (for each corner), tinting images, etc. Use this category if you want to add "colored style" to your app without having to generate colored graphic resources. + +Right now the category supports four types of operations: + +###I. Create images for a color, size & corner radius + + +The folowing methods are used to generate a UIImage for a specific color, size and/or corner radius. + + + (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size; + + (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size cornerRadius:(CGFloat)cornerRadius; + + (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size cornerInset:(UICornerInset)cornerInset; + +###II. Create resizable images for a color & corner radius + +These methods are perfect to use inside `UIButton`s or `UIImageView`s if you are plannig to add a specific background color with a corner radius but you don't want to use `QuartzCore`. Also, you can specify which corner you want to round. + + + + (UIImage*)resizableImageWithColor:(UIColor*)color; + + (UIImage*)resizableImageWithColor:(UIColor*)color cornerRadius:(CGFloat)cornerRadius; + + (UIImage*)resizableImageWithColor:(UIColor*)color cornerInset:(UICornerInset)cornerInset; + + +###III. Generate image with rounded corners + +You can use these methods to get a corner rounded image version from a current image. + + - (UIImage*)imageWithRoundedBounds; + - (UIImage*)imageWithCornerRadius:(CGFloat)cornerRadius; + - (UIImage*)imageWithCornerInset:(UICornerInset)cornerInset; + - (BOOL)isValidCornerInset:(UICornerInset)cornerInset; + +###IV. Generate tinted image from existing image + +In order to avoid to generate multiple versions of the same image to use in different states (in `UIButton` for example), your designers can just create a single version and with these methods you can generate tinted versions of the same image. + + + (UIImage*)imageNamed:(NSString *)name tintColor:(UIColor*)color style:(UIImageTintedStyle)tintStyle; + - (UIImage*)tintedImageWithColor:(UIColor*)color style:(UIImageTintedStyle)tintStyle; + +You can use the following tint styles: + +* Use `UIImageTintedStyleKeepingAlpha` to keep transaprent pixels and tint only those that are not translucid. +* Use `UIImageTintedStyleOverAlpha` to keep non transparent pixels and tint only those that are translucid. + +###V. Superposing images + +You can easily create an image by superposing two images. Calling the method: + + - (UIImage *)imageAddingImage:(UIImage*)image offset:(CGPoint)offset; + +The result is an image with the caller image as background and the given image as a top image. Also, you can specify an offset for the top image. + +###VI. Generate Gradients +You can create linear gradient images (with two colors or more) using the following methods: + + + (UIImage*)imageWithGradient:(NSArray*)colors size:(CGSize)size direction:(UIImageGradientDirection)direction; + + (UIImage*)resizableImageWithGradient:(NSArray*)colors size:(CGSize)size direction:(UIImageGradientDirection)direction; + +The first method returns an image with a gradient using the specified colors and direction of the given size. +The second method returns the smallest resizable image that can generate the desired gradient for the given size. + + +### Notes + +1. This category take care of scaling properties depending of the device resolution (retina or not) or the original image scale property. + +2. All static methods cache images so two consequtives calls with the same parameters returns the same image. + +--- +## Licence ## + +Copyright (c) 2013 Joan Martin, vilanovi@gmail.com. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE diff --git a/Demo/Pods/UIImage+Additions/UIImage+Additions.h b/Demo/Pods/UIImage+Additions/UIImage+Additions.h new file mode 100644 index 0000000..073f05e --- /dev/null +++ b/Demo/Pods/UIImage+Additions/UIImage+Additions.h @@ -0,0 +1,139 @@ +// +// UIImage+Additions.h +// Created by Joan Martin. +// Take a look to my repos at http://github.com/vilanovi +// +// Copyright (c) 2013 Joan Martin, vilanovi@gmail.com. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE + +#import + +typedef struct __UICornerInset +{ + CGFloat topLeft; + CGFloat topRight; + CGFloat bottomLeft; + CGFloat bottomRight; +} UICornerInset; + +UIKIT_EXTERN const UICornerInset UICornerInsetZero; + +UIKIT_STATIC_INLINE UICornerInset UICornerInsetMake(CGFloat topLeft, CGFloat topRight, CGFloat bottomLeft, CGFloat bottomRight) +{ + UICornerInset cornerInset = {topLeft, topRight, bottomLeft, bottomRight}; + return cornerInset; +} + +UIKIT_STATIC_INLINE UICornerInset UICornerInsetMakeWithRadius(CGFloat radius) +{ + UICornerInset cornerInset = {radius, radius, radius, radius}; + return cornerInset; +} + +UIKIT_STATIC_INLINE BOOL UICornerInsetEqualToCornerInset(UICornerInset cornerInset1, UICornerInset cornerInset2) +{ + return + cornerInset1.topLeft == cornerInset2.topLeft && + cornerInset1.topRight == cornerInset2.topRight && + cornerInset1.bottomLeft == cornerInset2.bottomLeft && + cornerInset1.bottomRight == cornerInset2.bottomRight; +} + +FOUNDATION_EXTERN NSString* NSStringFromUICornerInset(UICornerInset cornerInset); + +typedef enum __UIImageTintedStyle +{ + UIImageTintedStyleKeepingAlpha = 1, + UIImageTintedStyleOverAlpha = 2 +} UIImageTintedStyle; + +typedef enum __UIImageGradientDirection +{ + UIImageGradientDirectionVertical = 1, + UIImageGradientDirectionHorizontal = 2, +} UIImageGradientDirection; + +@interface UIImage (Additions) + +/* + * Create images from colors + */ ++ (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size; ++ (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size cornerRadius:(CGFloat)cornerRadius; ++ (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size cornerInset:(UICornerInset)cornerInset; + +/* + * Create rezisable images from colors + */ ++ (UIImage*)resizableImageWithColor:(UIColor*)color; ++ (UIImage*)resizableImageWithColor:(UIColor*)color cornerRadius:(CGFloat)cornerRadius; ++ (UIImage*)resizableImageWithColor:(UIColor*)color cornerInset:(UICornerInset)cornerInset; + ++ (UIImage*)blackColorImage; ++ (UIImage*)darkGrayColorImage; ++ (UIImage*)lightGrayColorImage; ++ (UIImage*)whiteColorImage; ++ (UIImage*)grayColorImage; ++ (UIImage*)redColorImage; ++ (UIImage*)greenColorImage; ++ (UIImage*)blueColorImage; ++ (UIImage*)cyanColorImage; ++ (UIImage*)yellowColorImage; ++ (UIImage*)magentaColorImage; ++ (UIImage*)orangeColorImage; ++ (UIImage*)purpleColorImage; ++ (UIImage*)brownColorImage; ++ (UIImage*)clearColorImage; + +/* + * Tint Images + */ ++ (UIImage*)imageNamed:(NSString *)name tintColor:(UIColor*)color style:(UIImageTintedStyle)tintStyle; +- (UIImage*)tintedImageWithColor:(UIColor*)color style:(UIImageTintedStyle)tintStyle; + +/* + * Rounding corners + */ +- (UIImage*)imageWithRoundedBounds; +- (UIImage*)imageWithCornerRadius:(CGFloat)cornerRadius; +- (UIImage*)imageWithCornerInset:(UICornerInset)cornerInset; +- (BOOL)isValidCornerInset:(UICornerInset)cornerInset; + +/* + * Drawing image on image + */ +- (UIImage*)imageAddingImage:(UIImage*)image; +- (UIImage*)imageAddingImage:(UIImage*)image offset:(CGPoint)offset; + +/* + * Gradient image generation + */ ++ (UIImage*)imageWithGradient:(NSArray*)colors size:(CGSize)size direction:(UIImageGradientDirection)direction; ++ (UIImage*)resizableImageWithGradient:(NSArray*)colors size:(CGSize)size direction:(UIImageGradientDirection)direction; + +@end + +#pragma mark - Categories + +@interface NSValue (UICornerInset) + ++ (NSValue*)valueWithUICornerInset:(UICornerInset)cornerInset; +- (UICornerInset)UICornerInsetValue; + +@end diff --git a/Demo/Pods/UIImage+Additions/UIImage+Additions.m b/Demo/Pods/UIImage+Additions/UIImage+Additions.m new file mode 100644 index 0000000..0ceada5 --- /dev/null +++ b/Demo/Pods/UIImage+Additions/UIImage+Additions.m @@ -0,0 +1,601 @@ +// +// UIImage+Additions.m +// Created by Joan Martin. +// Take a look to my repos at http://github.com/vilanovi +// +// Copyright (c) 2013 Joan Martin, vilanovi@gmail.com. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights to +// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +// of the Software, and to permit persons to whom the Software is furnished to do +// so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE + +#import "UIImage+Additions.h" + +@interface NSString (MD5Hashing) + +- (NSString*)md5; + +@end + +#import + +@implementation NSString (MD5Hashing) + +- (NSString *)md5 +{ + const char *cStr = [self UTF8String]; + unsigned char result[16]; + + CC_MD5(cStr, (CC_LONG)strlen(cStr), result); + + return [NSString stringWithFormat: + @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + result[0], result[1], result[2], result[3], + result[4], result[5], result[6], result[7], + result[8], result[9], result[10], result[11], + result[12], result[13], result[14], result[15] + ]; +} + +@end + +const UICornerInset UICornerInsetZero = {0.0f, 0.0f, 0.0f, 0.0f}; + +NSString* NSStringFromUICornerInset(UICornerInset cornerInset) +{ + return [NSString stringWithFormat:@"UICornerInset ",cornerInset.topLeft, cornerInset.topRight, cornerInset.bottomLeft, cornerInset.bottomRight]; +} + +static NSCache * _imageCache = nil; + +static NSString * kUIImageName = @"kUIImageName"; +static NSString * kUIImageResizableImage = @"kUIImageResizableImage"; +static NSString * kUIImageColors = @"kUIImageColors"; +static NSString * kUIImageTintColor = @"kUIImageTintColor"; +static NSString * kUIImageTintStyle = @"kUIImageTintStyle"; +static NSString * kUIImageCornerInset = @"kUIImageCornerInset"; +static NSString * kUIImageGradientDirection = @"kUIImageGradientDirection"; +static NSString * kUIImageSize = @"kUIImageSize"; + +@implementation UIImage (Additions) + ++ (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size +{ + return [self imageWithColor:color size:size cornerInset:UICornerInsetZero]; +} + ++ (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size cornerRadius:(CGFloat)cornerRadius +{ + return [self imageWithColor:color size:size cornerInset:UICornerInsetMake(cornerRadius, cornerRadius, cornerRadius, cornerRadius)]; +} + ++ (UIImage*)imageWithColor:(UIColor*)color size:(CGSize)size cornerInset:(UICornerInset)cornerInset +{ + return [self _imageWithColor:color size:size cornerInset:cornerInset saveInCache:YES]; +} + ++ (UIImage*)resizableImageWithColor:(UIColor*)color +{ + return [self resizableImageWithColor:color cornerInset:UICornerInsetZero]; +} + ++ (UIImage*)resizableImageWithColor:(UIColor*)color cornerRadius:(CGFloat)cornerRadius +{ + return [self resizableImageWithColor:color cornerInset:UICornerInsetMake(cornerRadius, cornerRadius, cornerRadius, cornerRadius)]; +} + ++ (UIImage*)resizableImageWithColor:(UIColor*)color cornerInset:(UICornerInset)cornerInset +{ + if (!color) + return nil; + + NSDictionary *descriptors = @{kUIImageColors : @[color], + kUIImageResizableImage : @YES, + kUIImageCornerInset : [NSValue valueWithUICornerInset:cornerInset]}; + + UIImage *image = [self _cachedImageWithDescriptors:descriptors]; + + if (image) + return image; + + CGSize size = CGSizeMake(MAX(cornerInset.topLeft, cornerInset.bottomLeft) + MAX(cornerInset.topRight, cornerInset.bottomRight) + 1, + MAX(cornerInset.topLeft, cornerInset.topRight) + MAX(cornerInset.bottomLeft, cornerInset.bottomRight) + 1); + + UIEdgeInsets capInsets = UIEdgeInsetsMake(MAX(cornerInset.topLeft, cornerInset.topRight), + MAX(cornerInset.topLeft, cornerInset.bottomLeft), + MAX(cornerInset.bottomLeft, cornerInset.bottomRight), + MAX(cornerInset.topRight, cornerInset.bottomRight)); + + image = [[self imageWithColor:color size:size cornerInset:cornerInset] resizableImageWithCapInsets:capInsets]; + + [self _cacheImage:image withDescriptors:descriptors]; + + return image; +} + ++ (UIImage*)blackColorImage +{ + return [self resizableImageWithColor:[UIColor blackColor]]; +} + ++ (UIImage*)darkGrayColorImage +{ + return [self resizableImageWithColor:[UIColor darkGrayColor]]; +} + ++ (UIImage*)lightGrayColorImage +{ + return [self resizableImageWithColor:[UIColor lightGrayColor]]; +} + ++ (UIImage*)whiteColorImage +{ + return [self resizableImageWithColor:[UIColor whiteColor]]; +} + ++ (UIImage*)grayColorImage +{ + return [self resizableImageWithColor:[UIColor grayColor]]; +} + ++ (UIImage*)redColorImage +{ + return [self resizableImageWithColor:[UIColor redColor]]; +} + ++ (UIImage*)greenColorImage +{ + return [self resizableImageWithColor:[UIColor greenColor]]; +} + ++ (UIImage*)blueColorImage +{ + return [self resizableImageWithColor:[UIColor blueColor]]; +} + ++ (UIImage*)cyanColorImage +{ + return [self resizableImageWithColor:[UIColor cyanColor]]; +} + ++ (UIImage*)yellowColorImage +{ + return [self resizableImageWithColor:[UIColor yellowColor]]; +} + ++ (UIImage*)magentaColorImage +{ + return [self resizableImageWithColor:[UIColor magentaColor]]; +} + ++ (UIImage*)orangeColorImage +{ + return [self resizableImageWithColor:[UIColor orangeColor]]; +} + ++ (UIImage*)purpleColorImage +{ + return [self resizableImageWithColor:[UIColor purpleColor]]; +} + ++ (UIImage*)brownColorImage +{ + return [self resizableImageWithColor:[UIColor brownColor]]; +} + ++ (UIImage*)clearColorImage +{ + return [self resizableImageWithColor:[UIColor clearColor]]; +} + ++ (UIImage*)imageNamed:(NSString *)name tintColor:(UIColor*)color style:(UIImageTintedStyle)tintStyle +{ + if (!name) + return nil; + + UIImage *image = [UIImage imageNamed:name]; + + if (!image) + return nil; + + if (!color) + return image; + + NSDictionary *descriptors = @{kUIImageName : name, + kUIImageTintColor : color, + kUIImageTintStyle : @(tintStyle)}; + + UIImage *tintedImage = [self _cachedImageWithDescriptors:descriptors]; + + if (!tintedImage) + { + tintedImage = [image tintedImageWithColor:color style:tintStyle]; + [self _cacheImage:tintedImage withDescriptors:descriptors]; + } + + return tintedImage; +} + +- (UIImage*)tintedImageWithColor:(UIColor*)color style:(UIImageTintedStyle)tintStyle +{ + if (!color) + return self; + + CGFloat scale = self.scale; + CGSize size = CGSizeMake(scale * self.size.width, scale * self.size.height); + + UIGraphicsBeginImageContext(size); + + CGContextRef context = UIGraphicsGetCurrentContext(); + + CGContextTranslateCTM(context, 0, size.height); + CGContextScaleCTM(context, 1.0, -1.0); + + CGRect rect = CGRectMake(0, 0, size.width, size.height); + // --- + + if (tintStyle == UIImageTintedStyleOverAlpha) + { + [color setFill]; + CGContextFillRect(context, rect); + } + + // draw alpha-mask + CGContextSetBlendMode(context, kCGBlendModeNormal); + CGContextDrawImage(context, rect, self.CGImage); + + if (tintStyle == UIImageTintedStyleKeepingAlpha) + { + CGContextSetBlendMode(context, kCGBlendModeSourceIn); + [color setFill]; + CGContextFillRect(context, rect); + } + + // --- + CGImageRef bitmapContext = CGBitmapContextCreateImage(context); + + UIImage *coloredImage = [UIImage imageWithCGImage:bitmapContext scale:scale orientation:UIImageOrientationUp]; + + CGImageRelease(bitmapContext); + + UIGraphicsEndImageContext(); + + return coloredImage; +} + +- (UIImage*)imageWithRoundedBounds +{ + CGSize size = self.size; + CGFloat radius = MIN(size.width, size.height) / 2.0; + return [self imageWithCornerRadius:radius]; +} + +- (UIImage*)imageWithCornerRadius:(CGFloat)cornerRadius +{ + return [self imageWithCornerInset:UICornerInsetMake(cornerRadius, cornerRadius, cornerRadius, cornerRadius)]; +} + +- (UIImage *)imageWithCornerInset:(UICornerInset)cornerInset +{ + if (![self isValidCornerInset:cornerInset]) + return nil; + + CGFloat scale = self.scale; + + CGRect rect = CGRectMake(0.0f, 0.0f, scale*self.size.width, scale*self.size.height); + + cornerInset.topRight *= scale; + cornerInset.topLeft *= scale; + cornerInset.bottomLeft *= scale; + cornerInset.bottomRight *= scale; + + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CGContextRef context = CGBitmapContextCreate(NULL, rect.size.width, rect.size.height, 8, 0, colorSpace, (CGBitmapInfo)kCGImageAlphaPremultipliedLast); + CGColorSpaceRelease(colorSpace); + + if (context == NULL) + return nil; + + CGFloat minx = CGRectGetMinX(rect), midx = CGRectGetMidX(rect), maxx = CGRectGetMaxX(rect); + CGFloat miny = CGRectGetMinY(rect), midy = CGRectGetMidY(rect), maxy = CGRectGetMaxY(rect); + CGContextBeginPath(context); + CGContextMoveToPoint(context, minx, midy); + CGContextAddArcToPoint(context, minx, miny, midx, miny, cornerInset.bottomLeft); + CGContextAddArcToPoint(context, maxx, miny, maxx, midy, cornerInset.bottomRight); + CGContextAddArcToPoint(context, maxx, maxy, midx, maxy, cornerInset.topRight); + CGContextAddArcToPoint(context, minx, maxy, minx, midy, cornerInset.topLeft); + CGContextClosePath(context); + CGContextClip(context); + + CGContextDrawImage(context, rect, self.CGImage); + + CGImageRef bitmapImageRef = CGBitmapContextCreateImage(context); + + CGContextRelease(context); + + UIImage *newImage = [UIImage imageWithCGImage:bitmapImageRef scale:scale orientation:UIImageOrientationUp]; + + CGImageRelease(bitmapImageRef); + + return newImage; +} + +- (BOOL)isValidCornerInset:(UICornerInset)cornerInset +{ + CGSize size = self.size; + + BOOL isValid = YES; + + if (cornerInset.topLeft + cornerInset.topRight > size.width) + isValid = NO; + + else if (cornerInset.topRight + cornerInset.bottomRight > size.height) + isValid = NO; + + else if (cornerInset.bottomRight + cornerInset.bottomLeft > size.width) + isValid = NO; + + else if (cornerInset.bottomLeft + cornerInset.topLeft > size.height) + isValid = NO; + + return isValid; +} + +- (UIImage*)imageAddingImage:(UIImage*)image +{ + CGSize size1 = self.size; + CGSize size2 = image.size; + + CGPoint offset = CGPointMake(floorf((size1.width - size2.width)/2.0), + floorf((size1.height - size2.height)/2.0)); + return [self imageAddingImage:image offset:offset]; +} + +- (UIImage*)imageAddingImage:(UIImage*)image offset:(CGPoint)offset +{ + CGSize size = self.size; + CGFloat scale = self.scale; + + size.width *= scale; + size.height *= scale; + + UIGraphicsBeginImageContext(size); + + [self drawInRect:CGRectMake( 0, 0, size.width, size.height)]; + + [image drawInRect:CGRectMake(scale * offset.x, scale * offset.y, image.size.width * scale, image.size.height * scale)]; + + CGContextRef context = UIGraphicsGetCurrentContext(); + CGImageRef bitmapContext = CGBitmapContextCreateImage(context); + UIImage *destImage = [UIImage imageWithCGImage:bitmapContext scale:image.scale orientation:UIImageOrientationUp]; + UIGraphicsEndImageContext(); + CGImageRelease(bitmapContext); + + return destImage; +} + +#pragma mark Private Methods + ++ (NSCache*)_cache +{ + if (!_imageCache) + _imageCache = [[NSCache alloc] init]; + + return _imageCache; +} + ++ (UIImage*)_cachedImageWithDescriptors:(NSDictionary*)descriptors +{ + return [[self _cache] objectForKey:[self _keyForImageWithDescriptors:descriptors]]; +} + ++ (void)_cacheImage:(UIImage*)image withDescriptors:(NSDictionary*)descriptors +{ + NSString *key = [self _keyForImageWithDescriptors:descriptors]; + [[self _cache] setObject:image forKey:key]; +} + ++ (NSString*)_keyForImageWithDescriptors:(NSDictionary*)descriptors +{ + NSMutableString *string = [NSMutableString string]; + + NSString *imageName = [descriptors valueForKey:kUIImageName]; + [string appendFormat:@"<%@:%@>",kUIImageName,(imageName == nil)?@"":imageName]; + [string appendFormat:@"<%@:%@>",kUIImageSize, NSStringFromCGSize([[descriptors valueForKey:kUIImageSize] CGSizeValue])]; + [string appendFormat:@"<%@:%d>",kUIImageResizableImage,[[descriptors valueForKey:kUIImageResizableImage] boolValue]]; + + [string appendFormat:@"<%@:",kUIImageColors]; + NSArray *colors = [descriptors valueForKey:kUIImageColors]; + for (UIColor *color in colors) + [string appendFormat:@"%ld",(long)color.hash]; + [string appendFormat:@">"]; + + [string appendFormat:@"<%@:%ld>",kUIImageTintColor,(long)[[descriptors valueForKey:kUIImageTintColor] hash]]; + [string appendFormat:@"<%@:%ld>",kUIImageTintStyle,(long)[[descriptors valueForKey:kUIImageTintStyle] integerValue]]; + [string appendFormat:@"<%@:%@>",kUIImageCornerInset,NSStringFromUICornerInset([[descriptors valueForKey:kUIImageCornerInset] UICornerInsetValue])]; + [string appendFormat:@"<%@:%ld>",kUIImageGradientDirection,(long)[[descriptors valueForKey:kUIImageGradientDirection] integerValue]]; + + return [string md5]; +} + ++ (UIImage*)_imageWithColor:(UIColor*)color size:(CGSize)size cornerInset:(UICornerInset)cornerInset saveInCache:(BOOL)save +{ + NSDictionary *descriptors = @{kUIImageColors : @[color], + kUIImageSize : [NSValue valueWithCGSize:size], + kUIImageCornerInset : [NSValue valueWithUICornerInset:cornerInset]}; + + UIImage *image = [self _cachedImageWithDescriptors:descriptors]; + + if (image) + return image; + + CGFloat scale = [[UIScreen mainScreen] scale]; + CGRect rect = CGRectMake(0.0f, 0.0f, scale*size.width, scale*size.height); + + cornerInset.topRight *= scale; + cornerInset.topLeft *= scale; + cornerInset.bottomLeft *= scale; + cornerInset.bottomRight *= scale; + + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CGContextRef context = CGBitmapContextCreate(NULL, rect.size.width, rect.size.height, 8, 0, colorSpace, (CGBitmapInfo)kCGImageAlphaPremultipliedLast); + + CGColorSpaceRelease(colorSpace); + + if (context == NULL) + return nil; + + CGFloat minx = CGRectGetMinX(rect), midx = CGRectGetMidX(rect), maxx = CGRectGetMaxX(rect); + CGFloat miny = CGRectGetMinY(rect), midy = CGRectGetMidY(rect), maxy = CGRectGetMaxY(rect); + + CGContextBeginPath(context); + CGContextSetGrayFillColor(context, 1.0, 0.0); // <-- Alpha color in background + CGContextAddRect(context, rect); + CGContextClosePath(context); + CGContextDrawPath(context, kCGPathFill); + + CGContextSetFillColorWithColor(context, [color CGColor]); // <-- Color to fill + CGContextBeginPath(context); + CGContextMoveToPoint(context, minx, midy); + CGContextAddArcToPoint(context, minx, miny, midx, miny, cornerInset.bottomLeft); + CGContextAddArcToPoint(context, maxx, miny, maxx, midy, cornerInset.bottomRight); + CGContextAddArcToPoint(context, maxx, maxy, midx, maxy, cornerInset.topRight); + CGContextAddArcToPoint(context, minx, maxy, minx, midy, cornerInset.topLeft); + CGContextClosePath(context); + CGContextDrawPath(context, kCGPathFill); + + CGImageRef bitmapContext = CGBitmapContextCreateImage(context); + + CGContextRelease(context); + + UIImage *theImage = [UIImage imageWithCGImage:bitmapContext scale:scale orientation:UIImageOrientationUp]; + + CGImageRelease(bitmapContext); + + if (save) + [self _cacheImage:theImage withDescriptors:descriptors]; + + return theImage; +} + ++ (UIImage*)imageWithGradient:(NSArray*)colors size:(CGSize)size direction:(UIImageGradientDirection)direction +{ + + NSDictionary *descriptors = @{kUIImageColors: colors, + kUIImageSize: [NSValue valueWithCGSize:size], + kUIImageGradientDirection: @(direction)}; + + UIImage *image = [self _cachedImageWithDescriptors:descriptors]; + if (image) + return image; + + CGRect rect = CGRectMake(0, 0, size.width, size.height); + + UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0.0); + + CGContextRef context = UIGraphicsGetCurrentContext(); + + // Create Gradient + NSMutableArray *cgColors = [NSMutableArray arrayWithCapacity:colors.count]; + for (UIColor *color in colors) + [cgColors addObject:(id)color.CGColor]; + + CGColorSpaceRef space = CGColorSpaceCreateDeviceRGB(); + CGGradientRef gradient = CGGradientCreateWithColors(space, (__bridge CFArrayRef)cgColors, NULL); + + // Apply gradient + CGPoint startPoint = CGPointZero; + CGPoint endPoint = CGPointZero; + + if (direction == UIImageGradientDirectionVertical) + endPoint = CGPointMake(0, rect.size.height); + + else if (direction == UIImageGradientDirectionHorizontal) + endPoint = CGPointMake(rect.size.width, 0); + + CGContextDrawLinearGradient(context, gradient, startPoint, endPoint, 0); + image = UIGraphicsGetImageFromCurrentImageContext(); + + // Clean memory & End context + UIGraphicsEndImageContext(); + CGGradientRelease(gradient); + CGColorSpaceRelease(space); + + [self _cacheImage:image withDescriptors:descriptors]; + + return image; +} + ++ (UIImage*)resizableImageWithGradient:(NSArray*)colors size:(CGSize)size direction:(UIImageGradientDirection)direction +{ + if ((size.width == 0.0f && direction == UIImageGradientDirectionHorizontal) || + (size.height == 0.0f && direction == UIImageGradientDirectionVertical) || + (size.height == 0.0f && size.width == 0.0f)) + return nil; + + NSDictionary *descriptors = @{kUIImageColors: colors, + kUIImageSize: [NSValue valueWithCGSize:size], + kUIImageGradientDirection: @(direction), + kUIImageResizableImage: @YES}; + + UIImage *image = [self _cachedImageWithDescriptors:descriptors]; + if (image) + return image; + + CGSize imageSize = CGSizeMake(1.0f, 1.0f); + + UIEdgeInsets insets = UIEdgeInsetsZero; + + if (direction == UIImageGradientDirectionVertical) + { + imageSize.height = size.height; + insets = UIEdgeInsetsMake(0.0f, 1.0f, 0.0f, 1.0f); + } + else if (direction == UIImageGradientDirectionHorizontal) + { + imageSize.width = size.width; + insets = UIEdgeInsetsMake(1.0f, 0.0f, 1.0f, 0.0f); + } + + return [[self imageWithGradient:colors size:imageSize direction:direction] resizableImageWithCapInsets:insets]; +} + +@end + +#pragma mark - Categories + +@implementation NSValue (UICornerInset) + ++ (NSValue*)valueWithUICornerInset:(UICornerInset)cornerInset +{ + CGRect rect = CGRectMake(cornerInset.topLeft, cornerInset.topRight, cornerInset.bottomLeft, cornerInset.bottomRight); + return [NSValue valueWithCGRect:rect]; + + // UICornerInset inset = cornerInset; + // return [[NSValue alloc] initWithBytes:&inset objCType:@encode(struct __UICornerInset)]; +} + +- (UICornerInset)UICornerInsetValue +{ + CGRect rect = [self CGRectValue]; + return UICornerInsetMake(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height); + + // UICornerInset cornerInset; + // [self getValue:&cornerInset]; + // return cornerInset; +} + +@end From 7d6cdbf02e51b2c625d7648756692292b45f4417 Mon Sep 17 00:00:00 2001 From: Mathias Amnell Date: Sat, 19 Jul 2014 12:59:35 +0200 Subject: [PATCH 3/6] Code cleanup --- .../UIScrollView+APParallaxHeader.h | 50 +++++++++++++++--- .../UIScrollView+APParallaxHeader.m | 51 ++++++++----------- 2 files changed, 64 insertions(+), 37 deletions(-) diff --git a/APParallaxHeader/UIScrollView+APParallaxHeader.h b/APParallaxHeader/UIScrollView+APParallaxHeader.h index c325004..2531a78 100755 --- a/APParallaxHeader/UIScrollView+APParallaxHeader.h +++ b/APParallaxHeader/UIScrollView+APParallaxHeader.h @@ -14,11 +14,36 @@ @interface UIScrollView (APParallaxHeader) +/** + * Adds a parallax with an image, an initial height and a bottom inner shadow. + * + * @param image An UIImage to parallax when scrolling. + * @param height The max height for the parallax header + * @param shadow BOOL to show or hide the bottom inner shadow. + */ - (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height andShadow:(BOOL)shadow; + +/** + * Adds a parallax with an image and an initial height. + * + * @param image An UIImage to parallax when scrolling. + * @param height The max height for the parallax header. + */ - (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height; -- (void)addParallaxWithView:(UIView*)view andHeight:(CGFloat)height; +/** + * Adds a parallax with a custom view with a given initial height. + * + * @param view A UIView to display in the parallax header. + * @param height The max height for the parallax header. + */ +- (void)addParallaxWithView:(UIView *)view andHeight:(CGFloat)height; + +/** + * Getter for the parallaxView + */ @property (nonatomic, strong, readonly) APParallaxView *parallaxView; + @property (nonatomic, assign) BOOL showsParallax; @end @@ -27,16 +52,10 @@ @protocol APParallaxViewDelegate; -typedef NS_ENUM(NSUInteger, APParallaxTrackingState) { - APParallaxTrackingActive = 0, - APParallaxTrackingInactive -}; - @interface APParallaxView : UIView @property (weak) id delegate; -@property (nonatomic, readonly) APParallaxTrackingState state; @property (nonatomic, strong) UIImageView *imageView; @property (nonatomic, strong) UIView *currentSubView; @property (nonatomic, strong) APParallaxShadowView *shadowView; @@ -45,9 +64,26 @@ typedef NS_ENUM(NSUInteger, APParallaxTrackingState) { @end +/** + * The APParallaxView delegate will allow you to get information for when the + * parallax header view will change its frame, so that you can do your repositioning etc. + */ @protocol APParallaxViewDelegate @optional +/** + * Delegate call for when the APParallaxView will change its frame. + * + * @param view The APParallaxView that will change its frame. + * @param frame The target frame. + */ - (void)parallaxView:(APParallaxView *)view willChangeFrame:(CGRect)frame; + +/** + * Delegate call for when the APParallaxView did change its frame. + * + * @param view The APParallaxView that changed its frame. + * @param frame The target frame. + */ - (void)parallaxView:(APParallaxView *)view didChangeFrame:(CGRect)frame; @end diff --git a/APParallaxHeader/UIScrollView+APParallaxHeader.m b/APParallaxHeader/UIScrollView+APParallaxHeader.m index 8517878..16f9845 100755 --- a/APParallaxHeader/UIScrollView+APParallaxHeader.m +++ b/APParallaxHeader/UIScrollView+APParallaxHeader.m @@ -9,9 +9,9 @@ #import -@interface APParallaxView () +static char contentOffsetContext; -@property (nonatomic, readwrite) APParallaxTrackingState state; +@interface APParallaxView () @property (nonatomic, weak) UIScrollView *scrollView; @property (nonatomic, readwrite) CGFloat originalTopInset; @@ -60,7 +60,7 @@ - (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height andShado } } -- (void)addParallaxWithView:(UIView*)view andHeight:(CGFloat)height { +- (void)addParallaxWithView:(UIView *)view andHeight:(CGFloat)height { if(self.parallaxView) { [self.parallaxView.currentSubView removeFromSuperview]; [view setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight]; @@ -104,14 +104,12 @@ - (void)setShowsParallax:(BOOL)showsParallax { if(!showsParallax) { if (self.parallaxView.isObserving) { [self removeObserver:self.parallaxView forKeyPath:@"contentOffset"]; - [self removeObserver:self.parallaxView forKeyPath:@"frame"]; self.parallaxView.isObserving = NO; } } else { if (!self.parallaxView.isObserving) { - [self addObserver:self.parallaxView forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionNew context:nil]; - [self addObserver:self.parallaxView forKeyPath:@"frame" options:NSKeyValueObservingOptionNew context:nil]; + [self addObserver:self.parallaxView forKeyPath:@"contentOffset" options:NSKeyValueObservingOptionNew context:&contentOffsetContext]; self.parallaxView.isObserving = YES; } } @@ -185,7 +183,6 @@ - (id)initWithFrame:(CGRect)frame andShadow:(BOOL)shadow { if(self = [super initWithFrame:frame]) { // default styling values [self setAutoresizingMask:UIViewAutoresizingFlexibleHeight]; - [self setState:APParallaxTrackingActive]; [self setAutoresizesSubviews:YES]; self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(frame), CGRectGetHeight(frame))]; @@ -211,7 +208,6 @@ - (void)willMoveToSuperview:(UIView *)newSuperview { if (self.isObserving) { //If enter this branch, it is the moment just before "APParallaxView's dealloc", so remove observer here [scrollView removeObserver:self forKeyPath:@"contentOffset"]; - [scrollView removeObserver:self forKeyPath:@"frame"]; self.isObserving = NO; } } @@ -226,38 +222,33 @@ - (void)addSubview:(UIView *)view { #pragma mark - Observing - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - if([keyPath isEqualToString:@"contentOffset"]) { + if(context == &contentOffsetContext) { [self scrollViewDidScroll:[[change valueForKey:NSKeyValueChangeNewKey] CGPointValue]]; } - else if([keyPath isEqualToString:@"frame"]) { - [self layoutSubviews]; - } } -#define MIN_HEIGHT 64 +#define MIN_HEIGHT 0 + +- (void)setFrame:(CGRect)frame { + if ([self.delegate respondsToSelector:@selector(parallaxView:willChangeFrame:)]) { + [self.delegate parallaxView:self willChangeFrame:self.frame]; + } + + [super setFrame:frame]; + + if ([self.delegate respondsToSelector:@selector(parallaxView:didChangeFrame:)]) { + [self.delegate parallaxView:self didChangeFrame:self.frame]; + } +} - (void)scrollViewDidScroll:(CGPoint)contentOffset { // Resize/reposition the parallaxView based on the content offset CGFloat yOffset = contentOffset.y*-1; - if (yOffset <= MIN_HEIGHT) { - CGRect rect = self.frame; - rect.origin.y = contentOffset.y; - rect.size.height = MAX(MIN_HEIGHT, yOffset); - self.frame = rect; - } - else { - if ([self.delegate respondsToSelector:@selector(parallaxView:willChangeFrame:)]) { - [self.delegate parallaxView:self willChangeFrame:self.frame]; - } - - [self setFrame:CGRectMake(0, contentOffset.y, CGRectGetWidth(self.frame), yOffset)]; - - if ([self.delegate respondsToSelector:@selector(parallaxView:didChangeFrame:)]) { - [self.delegate parallaxView:self didChangeFrame:self.frame]; - } - } + CGFloat height = MAX(MIN_HEIGHT, yOffset); + [self setFrame:CGRectMake(0, contentOffset.y, CGRectGetWidth(self.frame), height)]; // Correct the scroll indicator position + // Without this the scroll indicator will be displayed on top of the parallax view if (self.scrollView.contentOffset.y < -self.parallaxHeight) { [self.scrollView setScrollIndicatorInsets:UIEdgeInsetsMake(self.scrollView.contentInset.top+(abs(self.scrollView.contentOffset.y)-self.parallaxHeight), 0, 0, 0)]; } From da5ad5f8e1f286938ba7d27bead2c4745f605bd7 Mon Sep 17 00:00:00 2001 From: Mathias Amnell Date: Tue, 22 Jul 2014 09:39:33 +0200 Subject: [PATCH 4/6] Code style fix --- APParallaxHeader/UIScrollView+APParallaxHeader.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/APParallaxHeader/UIScrollView+APParallaxHeader.m b/APParallaxHeader/UIScrollView+APParallaxHeader.m index 16f9845..2860328 100755 --- a/APParallaxHeader/UIScrollView+APParallaxHeader.m +++ b/APParallaxHeader/UIScrollView+APParallaxHeader.m @@ -39,8 +39,7 @@ - (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height andShado } [self.parallaxView.imageView setImage:image]; } - else - { + else { APParallaxView *view = [[APParallaxView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, height) andShadow:shadow]; [view setClipsToBounds:YES]; [view.imageView setImage:image]; From dbf63f7de21b3e69b6e51b2dd3417154ef3e93b0 Mon Sep 17 00:00:00 2001 From: Mathias Amnell Date: Thu, 9 Oct 2014 10:54:03 +0200 Subject: [PATCH 5/6] Auto layout fixups --- .../UIScrollView+APParallaxHeader.h | 1 - .../UIScrollView+APParallaxHeader.m | 45 +++++++------------ 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/APParallaxHeader/UIScrollView+APParallaxHeader.h b/APParallaxHeader/UIScrollView+APParallaxHeader.h index d379dce..cce4c0c 100755 --- a/APParallaxHeader/UIScrollView+APParallaxHeader.h +++ b/APParallaxHeader/UIScrollView+APParallaxHeader.h @@ -38,7 +38,6 @@ typedef NS_ENUM(NSUInteger, APParallaxTrackingState) { @property (nonatomic, readonly) APParallaxTrackingState state; @property (nonatomic, strong) UIImageView *imageView; -@property (nonatomic, strong) UIView *currentSubView; @property (nonatomic, strong) APParallaxShadowView *shadowView; @property (nonatomic, strong) UIView *customView; diff --git a/APParallaxHeader/UIScrollView+APParallaxHeader.m b/APParallaxHeader/UIScrollView+APParallaxHeader.m index 57e63e1..8b39cec 100755 --- a/APParallaxHeader/UIScrollView+APParallaxHeader.m +++ b/APParallaxHeader/UIScrollView+APParallaxHeader.m @@ -21,8 +21,6 @@ @interface APParallaxView () @end - - #pragma mark - UIScrollView (APParallaxHeader) #import @@ -36,14 +34,15 @@ - (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height { - (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height andShadow:(BOOL)shadow { if(self.parallaxView) { - if(self.parallaxView.currentSubView) { - [self.parallaxView.currentSubView removeFromSuperview]; + if(self.parallaxView.customView) { + [self.parallaxView.customView removeFromSuperview]; } [self.parallaxView.imageView setImage:image]; } else { - APParallaxView *parallaxView = [[APParallaxView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width*2, height) andShadow:shadow]; + APParallaxView *parallaxView = [[APParallaxView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, height) andShadow:shadow]; + [parallaxView setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight]; [parallaxView setClipsToBounds:YES]; [parallaxView.imageView setImage:image]; @@ -64,21 +63,22 @@ - (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height andShado - (void)addParallaxWithView:(UIView*)view andHeight:(CGFloat)height { if(self.parallaxView) { - [self.parallaxView.currentSubView removeFromSuperview]; + [self.parallaxView.customView removeFromSuperview]; [view setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight]; [self.parallaxView setCustomView:view]; } else { APParallaxView *parallaxView = [[APParallaxView alloc] initWithFrame:CGRectMake(0, 0, self.bounds.size.width, height)]; + [parallaxView setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight]; [parallaxView setClipsToBounds:YES]; - [parallaxView setCustomView:view]; parallaxView.scrollView = self; parallaxView.parallaxHeight = height; + [self addSubview:parallaxView]; - + parallaxView.originalTopInset = self.contentInset.top; UIEdgeInsets newInset = self.contentInset; @@ -147,7 +147,7 @@ - (void)drawRect:(CGRect)rect { //// Gradient Declarations NSArray* gradient3Colors = [NSArray arrayWithObjects: - (id)[UIColor colorWithWhite:0 alpha:0.3].CGColor, + (id)[UIColor colorWithWhite:0 alpha:0.2].CGColor, (id)[UIColor clearColor].CGColor, nil]; CGFloat gradient3Locations[] = {0, 1}; CGGradientRef gradient3 = CGGradientCreateWithColors(colorSpace, (__bridge CFArrayRef)gradient3Colors, gradient3Locations); @@ -182,9 +182,6 @@ - (id)initWithFrame:(CGRect)frame { - (id)initWithFrame:(CGRect)frame andShadow:(BOOL)shadow { if(self = [super initWithFrame:frame]) { - - [self setBackgroundColor:[UIColor redColor]]; - // default styling values [self setAutoresizingMask:UIViewAutoresizingFlexibleHeight]; [self setState:APParallaxTrackingActive]; @@ -224,11 +221,6 @@ - (void)willMoveToSuperview:(UIView *)newSuperview { } } -- (void)addSubview:(UIView *)view { - [super addSubview:view]; - self.currentSubView = view; -} - - (void)setCustomView:(UIView *)customView { if (_customView) { @@ -237,19 +229,16 @@ - (void)setCustomView:(UIView *)customView _customView = customView; - [self addSubview:customView]; - [customView setTranslatesAutoresizingMaskIntoConstraints:NO]; - [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[customView]|" options:0 metrics:nil views:@{@"customView" : customView}]]; - [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[customView]|" options:0 metrics:nil views:@{@"customView" : customView}]]; -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - if (self.shadowView) { - [self bringSubviewToFront:self.shadowView]; + [self insertSubview:customView belowSubview:self.shadowView]; + } + else { + [self addSubview:customView]; } + + [self.customView setTranslatesAutoresizingMaskIntoConstraints:NO]; + [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[customView]|" options:0 metrics:nil views:@{@"customView" : self.customView}]]; + [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[customView]|" options:0 metrics:nil views:@{@"customView" : self.customView}]]; } #pragma mark - Observing From d5d1a665d88e922e29fae36e65c6612ced42f10e Mon Sep 17 00:00:00 2001 From: Andrzej Krajniak Date: Tue, 17 May 2016 09:11:49 +0200 Subject: [PATCH 6/6] Added minHeight as a parameter --- .../UIScrollView+APParallaxHeader.h | 46 ++++++++++++++++++- .../UIScrollView+APParallaxHeader.m | 25 ++++++++-- .../APParallaxHeaderDemo-Prefix.pch | 2 - .../MasterViewController.m | 3 +- Demo/Podfile | 2 - Demo/Podfile.lock | 11 +---- 6 files changed, 69 insertions(+), 20 deletions(-) diff --git a/APParallaxHeader/UIScrollView+APParallaxHeader.h b/APParallaxHeader/UIScrollView+APParallaxHeader.h index a12d1ed..d749b3f 100755 --- a/APParallaxHeader/UIScrollView+APParallaxHeader.h +++ b/APParallaxHeader/UIScrollView+APParallaxHeader.h @@ -14,6 +14,23 @@ @interface UIScrollView (APParallaxHeader) +/** + * Adds a parallax with an image and an initial height. + * + * @param image An UIImage to parallax when scrolling. + * @param height The max height for the parallax header. + */ +- (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height; + +/** + * Adds a parallax with an image and an initial height. + * + * @param image An UIImage to parallax when scrolling. + * @param height The max height for the parallax header. + * @param minHeight The min height for the parallax header. + */ +- (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height andMinHeight:(CGFloat)minHeight; + /** * Adds a parallax with an image, an initial height and a bottom inner shadow. * @@ -28,8 +45,10 @@ * * @param image An UIImage to parallax when scrolling. * @param height The max height for the parallax header. + * @param minHeight The min height for the parallax header. + * @param shadow BOOL to show or hide the bottom inner shadow. */ -- (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height; +- (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height andMinHeight:(CGFloat)minHeight andShadow:(BOOL)shadow; /** * Adds a parallax with a custom view with a given initial height. @@ -39,8 +58,33 @@ */ - (void)addParallaxWithView:(UIView *)view andHeight:(CGFloat)height; +/** + * Adds a parallax with a custom view with a given initial height and minimum height. + * + * @param view A UIView to display in the parallax header. + * @param height The max height for the parallax header. + * @param minHeight The min height for the parallax header. + */ +- (void)addParallaxWithView:(UIView *)view andHeight:(CGFloat)height andMinHeight:(CGFloat)minHeight; + +/** + * Adds a parallax with a custom view with a given initial height and a bottom inner shadow. + * + * @param view A UIView to display in the parallax header. + * @param height The max height for the parallax header. + * @param shadow BOOL to show or hide the bottom inner shadow. + */ - (void)addParallaxWithView:(UIView*)view andHeight:(CGFloat)height andShadow:(BOOL)shadow; +/** + * Adds a parallax with a custom view with a given initial height and a bottom inner shadow. + * + * @param view A UIView to display in the parallax header. + * @param height The max height for the parallax header. + * @param minHeight The min height for the parallax header. + * @param shadow BOOL to show or hide the bottom inner shadow. + */ +- (void)addParallaxWithView:(UIView*)view andHeight:(CGFloat)height andMinHeight:(CGFloat)minHeight andShadow:(BOOL)shadow; /** * Getter for the parallaxView diff --git a/APParallaxHeader/UIScrollView+APParallaxHeader.m b/APParallaxHeader/UIScrollView+APParallaxHeader.m index 3f7572d..c4b557f 100755 --- a/APParallaxHeader/UIScrollView+APParallaxHeader.m +++ b/APParallaxHeader/UIScrollView+APParallaxHeader.m @@ -18,6 +18,7 @@ @interface APParallaxView () @property (nonatomic, weak) UIScrollView *scrollView; @property (nonatomic, readwrite) CGFloat originalTopInset; @property (nonatomic) CGFloat parallaxHeight; +@property (nonatomic) CGFloat parallaxMinHeight; @property(nonatomic, assign) BOOL isObserving; @@ -34,7 +35,15 @@ - (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height { [self addParallaxWithImage:image andHeight:height andShadow:YES]; } +- (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height andMinHeight:(CGFloat)minHeight { + [self addParallaxWithImage:image andHeight:height andShadow:YES]; +} + - (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height andShadow:(BOOL)shadow { + [self addParallaxWithImage:image andHeight:height andMinHeight:0 andShadow:shadow]; +} + +- (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height andMinHeight:(CGFloat)minHeight andShadow:(BOOL)shadow { if(self.parallaxView) { if(self.parallaxView.customView) { [self.parallaxView.customView removeFromSuperview]; @@ -49,6 +58,7 @@ - (void)addParallaxWithImage:(UIImage *)image andHeight:(CGFloat)height andShado parallaxView.scrollView = self; parallaxView.parallaxHeight = height; + parallaxView.parallaxMinHeight = minHeight; [self addSubview:parallaxView]; parallaxView.originalTopInset = self.contentInset.top; @@ -66,7 +76,15 @@ - (void)addParallaxWithView:(UIView*)view andHeight:(CGFloat)height { [self addParallaxWithView:view andHeight:height andShadow:YES]; } +- (void)addParallaxWithView:(UIView*)view andHeight:(CGFloat)height andMinHeight:(CGFloat)minHeight { + [self addParallaxWithView:view andHeight:height andMinHeight:minHeight andShadow:YES]; +} + - (void)addParallaxWithView:(UIView*)view andHeight:(CGFloat)height andShadow:(BOOL)shadow { + [self addParallaxWithView:view andHeight:height andMinHeight:0 andShadow:shadow]; +} + +- (void)addParallaxWithView:(UIView*)view andHeight:(CGFloat)height andMinHeight:(CGFloat)minHeight andShadow:(BOOL)shadow { if(self.parallaxView) { [self.parallaxView.customView removeFromSuperview]; [view setAutoresizingMask:UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight]; @@ -81,6 +99,7 @@ - (void)addParallaxWithView:(UIView*)view andHeight:(CGFloat)height andShadow:(B parallaxView.scrollView = self; parallaxView.parallaxHeight = height; + parallaxView.parallaxMinHeight = minHeight; [self addSubview:parallaxView]; @@ -257,8 +276,6 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N } } -#define MIN_HEIGHT 0 - - (void)setFrame:(CGRect)frame { if ([self.delegate respondsToSelector:@selector(parallaxView:willChangeFrame:)]) { [self.delegate parallaxView:self willChangeFrame:self.frame]; @@ -273,7 +290,7 @@ - (void)setFrame:(CGRect)frame { - (void)scrollViewDidScroll:(CGPoint)contentOffset { // We do not want to track when the parallax view is hidden - if (contentOffset.y > 0) { + if (contentOffset.y > 0 && self.parallaxMinHeight == 0) { [self setState:APParallaxTrackingInactive]; } else { [self setState:APParallaxTrackingActive]; @@ -282,7 +299,7 @@ - (void)scrollViewDidScroll:(CGPoint)contentOffset { if(self.state == APParallaxTrackingActive) { // Resize/reposition the parallaxView based on the content offset CGFloat yOffset = contentOffset.y*-1; - CGFloat height = MAX(MIN_HEIGHT, yOffset); + CGFloat height = MAX(self.parallaxMinHeight, yOffset); [self setFrame:CGRectMake(0, contentOffset.y, CGRectGetWidth(self.frame), height)]; // Correct the scroll indicator position diff --git a/Demo/APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch b/Demo/APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch index 2e45eb1..41ecb3c 100644 --- a/Demo/APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch +++ b/Demo/APParallaxHeaderDemo/APParallaxHeaderDemo-Prefix.pch @@ -11,6 +11,4 @@ #ifdef __OBJC__ #import #import - - #import #endif diff --git a/Demo/APParallaxHeaderDemo/MasterViewController.m b/Demo/APParallaxHeaderDemo/MasterViewController.m index c872f50..166c930 100644 --- a/Demo/APParallaxHeaderDemo/MasterViewController.m +++ b/Demo/APParallaxHeaderDemo/MasterViewController.m @@ -25,7 +25,6 @@ - (void)viewDidLoad { UIBarButtonItem *barButton = [[UIBarButtonItem alloc] initWithTitle:@"with view" style:UIBarButtonItemStylePlain target:self action:@selector(toggle:)]; [self.navigationItem setRightBarButtonItem:barButton]; - [self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor] size:CGSizeMake(200, 200)] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault]; [self.navigationController.navigationBar setShadowImage:[UIImage new]]; self.automaticallyAdjustsScrollViewInsets = NO; @@ -52,7 +51,7 @@ - (void)toggle:(id)sender { } else { // add parallax with image - [self.tableView addParallaxWithImage:[UIImage imageNamed:@"ParallaxImage.jpg"] andHeight:PARALLAX_HEIGHT andShadow:YES]; + [self.tableView addParallaxWithImage:[UIImage imageNamed:@"ParallaxImage.jpg"] andHeight:PARALLAX_HEIGHT andMinHeight:128 andShadow:YES]; _parallaxWithView = NO; // Update the toggle button diff --git a/Demo/Podfile b/Demo/Podfile index d22df99..633d3d0 100644 --- a/Demo/Podfile +++ b/Demo/Podfile @@ -1,4 +1,2 @@ # Uncomment this line to define a global platform for your project platform :ios, "7.0" - -pod 'UIImage+Additions' diff --git a/Demo/Podfile.lock b/Demo/Podfile.lock index 096e562..ef12354 100644 --- a/Demo/Podfile.lock +++ b/Demo/Podfile.lock @@ -1,10 +1,3 @@ -PODS: - - UIImage+Additions (1.1.0) +PODFILE CHECKSUM: 1add239d217c918b094ea5307c0da22e83d84c0d -DEPENDENCIES: - - UIImage+Additions - -SPEC CHECKSUMS: - UIImage+Additions: 66ee88773215955a2703ea31b790fdf3438303d9 - -COCOAPODS: 0.33.1 +COCOAPODS: 1.0.0