From 3ed9d961e462dcbe486765f6f9ead86dd23a95af Mon Sep 17 00:00:00 2001 From: Ruslan Skorb Date: Wed, 27 May 2015 09:45:31 +0300 Subject: [PATCH 1/5] [Image Crop View Controller] Fix the condition of displaying an image. --- RSKImageCropper/RSKImageCropViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RSKImageCropper/RSKImageCropViewController.m b/RSKImageCropper/RSKImageCropViewController.m index 62961e0..2b7ca27 100644 --- a/RSKImageCropper/RSKImageCropViewController.m +++ b/RSKImageCropper/RSKImageCropViewController.m @@ -398,7 +398,7 @@ - (void)setOriginalImage:(UIImage *)originalImage { if (![_originalImage isEqual:originalImage]) { _originalImage = originalImage; - if (self.isViewLoaded) { + if (self.isViewLoaded && self.view.window) { [self displayImage]; } } From d5f1725894d568f825ee47f4debc33f1a6a8b4d1 Mon Sep 17 00:00:00 2001 From: Ruslan Skorb Date: Wed, 27 May 2015 09:50:20 +0300 Subject: [PATCH 2/5] Version bump (1.1.4) --- .../RSKImageCropperExample/RSKImageCropperExample-Info.plist | 2 +- RSKImageCropper.podspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Example/RSKImageCropperExample/RSKImageCropperExample-Info.plist b/Example/RSKImageCropperExample/RSKImageCropperExample-Info.plist index 1e02ab8..88bd6f2 100755 --- a/Example/RSKImageCropperExample/RSKImageCropperExample-Info.plist +++ b/Example/RSKImageCropperExample/RSKImageCropperExample-Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.1.3 + 1.1.4 CFBundleSignature ???? CFBundleVersion diff --git a/RSKImageCropper.podspec b/RSKImageCropper.podspec index 548a03d..e982441 100644 --- a/RSKImageCropper.podspec +++ b/RSKImageCropper.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'RSKImageCropper' - s.version = '1.1.3' + s.version = '1.1.4' s.summary = 'An image cropper for iOS like in the Contacts app with support for landscape orientation.' s.homepage = 'https://github.com/ruslanskorb/RSKImageCropper' s.license = { :type => 'MIT', :file => 'LICENSE' } From f3af05153cb029a1beca91297444227541076f15 Mon Sep 17 00:00:00 2001 From: Ruslan Skorb Date: Wed, 27 May 2015 10:00:14 +0300 Subject: [PATCH 3/5] [Image Crop View Controller] Add support for the navigation bar with the custom shadow image. --- RSKImageCropper/RSKImageCropViewController.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/RSKImageCropper/RSKImageCropViewController.m b/RSKImageCropper/RSKImageCropViewController.m index 2b7ca27..e4b8e67 100644 --- a/RSKImageCropper/RSKImageCropViewController.m +++ b/RSKImageCropper/RSKImageCropViewController.m @@ -45,8 +45,9 @@ @interface RSKImageCropViewController () -@property (strong, nonatomic) UIColor *originalNavigationControllerViewBackgroundColor; @property (assign, nonatomic) BOOL originalNavigationControllerNavigationBarHidden; +@property (strong, nonatomic) UIImage *originalNavigationControllerNavigationBarShadowImage; +@property (strong, nonatomic) UIColor *originalNavigationControllerViewBackgroundColor; @property (assign, nonatomic) BOOL originalStatusBarHidden; @property (strong, nonatomic) RSKImageScrollView *imageScrollView; @@ -141,6 +142,9 @@ - (void)viewWillAppear:(BOOL)animated self.originalNavigationControllerNavigationBarHidden = self.navigationController.navigationBarHidden; [self.navigationController setNavigationBarHidden:YES animated:NO]; + + self.originalNavigationControllerNavigationBarShadowImage = self.navigationController.navigationBar.shadowImage; + self.navigationController.navigationBar.shadowImage = nil; } - (void)viewDidAppear:(BOOL)animated @@ -161,6 +165,7 @@ - (void)viewWillDisappear:(BOOL)animated } [self.navigationController setNavigationBarHidden:self.originalNavigationControllerNavigationBarHidden animated:animated]; + self.navigationController.navigationBar.shadowImage = self.originalNavigationControllerNavigationBarShadowImage; self.navigationController.view.backgroundColor = self.originalNavigationControllerViewBackgroundColor; } From 7e7013d03b219f0481b106f82391e4f12a1c398b Mon Sep 17 00:00:00 2001 From: Ruslan Skorb Date: Wed, 27 May 2015 10:21:52 +0300 Subject: [PATCH 4/5] [Image Crop View Controller Tests] Update test 'displays new original image'. --- .../RSKImageCropViewControllerTests.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Example/RSKImageCropperExampleTests/RSKImageCropViewControllerTests.m b/Example/RSKImageCropperExampleTests/RSKImageCropViewControllerTests.m index 5fa51f3..e1afe13 100644 --- a/Example/RSKImageCropperExampleTests/RSKImageCropViewControllerTests.m +++ b/Example/RSKImageCropperExampleTests/RSKImageCropViewControllerTests.m @@ -675,13 +675,18 @@ - (void)resetZoomScale; }); it(@"displays new original image", ^{ - id mock = [OCMockObject partialMockForObject:imageCropViewController]; - [[mock expect] displayImage]; + id mockImageCropViewControllerView = [OCMockObject partialMockForObject:imageCropViewController.view]; + [[[mockImageCropViewControllerView stub] andReturn:[[UIWindow alloc] init]] window]; + + id mockImageCropViewController = [OCMockObject partialMockForObject:imageCropViewController]; + [[[mockImageCropViewController stub] andReturn:mockImageCropViewControllerView] view]; + [[mockImageCropViewController expect] displayImage]; imageCropViewController.originalImage = [UIImage imageNamed:@"photo"]; - [mock verify]; - [mock stopMocking]; + [mockImageCropViewController verify]; + [mockImageCropViewController stopMocking]; + [mockImageCropViewControllerView stopMocking]; }); after(^{ From 541b1545ae2e0c4ea542d28432be4a28c6d275fe Mon Sep 17 00:00:00 2001 From: Ruslan Skorb Date: Wed, 27 May 2015 10:37:01 +0300 Subject: [PATCH 5/5] Version bump (1.1.5) --- .../RSKImageCropperExample/RSKImageCropperExample-Info.plist | 2 +- RSKImageCropper.podspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Example/RSKImageCropperExample/RSKImageCropperExample-Info.plist b/Example/RSKImageCropperExample/RSKImageCropperExample-Info.plist index 88bd6f2..f35f913 100755 --- a/Example/RSKImageCropperExample/RSKImageCropperExample-Info.plist +++ b/Example/RSKImageCropperExample/RSKImageCropperExample-Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.1.4 + 1.1.5 CFBundleSignature ???? CFBundleVersion diff --git a/RSKImageCropper.podspec b/RSKImageCropper.podspec index e982441..7ed87a8 100644 --- a/RSKImageCropper.podspec +++ b/RSKImageCropper.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'RSKImageCropper' - s.version = '1.1.4' + s.version = '1.1.5' s.summary = 'An image cropper for iOS like in the Contacts app with support for landscape orientation.' s.homepage = 'https://github.com/ruslanskorb/RSKImageCropper' s.license = { :type => 'MIT', :file => 'LICENSE' }