Skip to content

Commit 15e4be7

Browse files
committed
Update RSKImageCropper to version 1.2.1.
1 parent 716612d commit 15e4be7

8 files changed

+68
-14
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//
2+
// RSKImageCropViewController+Protected.h
3+
//
4+
// Copyright (c) 2014-present Ruslan Skorb, http://ruslanskorb.com/
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files (the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions:
12+
//
13+
// The above copyright notice and this permission notice shall be included in
14+
// all copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
// THE SOFTWARE.
23+
//
24+
25+
/**
26+
The methods in the RSKImageCropViewControllerProtectedMethods category
27+
typically should only be called by subclasses which are implementing new
28+
image crop view controllers. They may be overridden but must call super.
29+
*/
30+
@interface RSKImageCropViewController (RSKImageCropViewControllerProtectedMethods)
31+
32+
/**
33+
Asynchronously crops the original image in accordance with the current settings and tells the delegate that the original image will be / has been cropped.
34+
*/
35+
- (void)cropImage;
36+
37+
/**
38+
Tells the delegate that the crop has been canceled.
39+
*/
40+
- (void)cancelCrop;
41+
42+
/**
43+
Resets the rotation angle, the position and the zoom scale of the original image to the default values.
44+
45+
@param animated Set this value to YES to animate the reset.
46+
*/
47+
- (void)reset:(BOOL)animated;
48+
49+
@end

iphone/RSKImageCropper/RSKImageCropViewController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// RSKImageCropViewController.h
33
//
4-
// Copyright (c) 2014 Ruslan Skorb, http://ruslanskorb.com/
4+
// Copyright (c) 2014-present Ruslan Skorb, http://ruslanskorb.com/
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to deal

iphone/RSKImageCropper/RSKImageCropViewController.m

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// RSKImageCropViewController.m
33
//
4-
// Copyright (c) 2014 Ruslan Skorb, http://ruslanskorb.com/
4+
// Copyright (c) 2014-present Ruslan Skorb, http://ruslanskorb.com/
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to deal
@@ -45,8 +45,9 @@
4545

4646
@interface RSKImageCropViewController () <UIGestureRecognizerDelegate>
4747

48-
@property (strong, nonatomic) UIColor *originalNavigationControllerViewBackgroundColor;
4948
@property (assign, nonatomic) BOOL originalNavigationControllerNavigationBarHidden;
49+
@property (strong, nonatomic) UIImage *originalNavigationControllerNavigationBarShadowImage;
50+
@property (strong, nonatomic) UIColor *originalNavigationControllerViewBackgroundColor;
5051
@property (assign, nonatomic) BOOL originalStatusBarHidden;
5152

5253
@property (strong, nonatomic) RSKImageScrollView *imageScrollView;
@@ -141,6 +142,9 @@ - (void)viewWillAppear:(BOOL)animated
141142

142143
self.originalNavigationControllerNavigationBarHidden = self.navigationController.navigationBarHidden;
143144
[self.navigationController setNavigationBarHidden:YES animated:NO];
145+
146+
self.originalNavigationControllerNavigationBarShadowImage = self.navigationController.navigationBar.shadowImage;
147+
self.navigationController.navigationBar.shadowImage = nil;
144148
}
145149

146150
- (void)viewDidAppear:(BOOL)animated
@@ -161,6 +165,7 @@ - (void)viewWillDisappear:(BOOL)animated
161165
}
162166

163167
[self.navigationController setNavigationBarHidden:self.originalNavigationControllerNavigationBarHidden animated:animated];
168+
self.navigationController.navigationBar.shadowImage = self.originalNavigationControllerNavigationBarShadowImage;
164169
self.navigationController.view.backgroundColor = self.originalNavigationControllerViewBackgroundColor;
165170
}
166171

@@ -398,7 +403,7 @@ - (void)setOriginalImage:(UIImage *)originalImage
398403
{
399404
if (![_originalImage isEqual:originalImage]) {
400405
_originalImage = originalImage;
401-
if (self.isViewLoaded) {
406+
if (self.isViewLoaded && self.view.window) {
402407
[self displayImage];
403408
}
404409
}
@@ -468,7 +473,7 @@ - (void)handleRotation:(UIRotationGestureRecognizer *)gestureRecognizer
468473

469474
- (BOOL)isPortraitInterfaceOrientation
470475
{
471-
return CGRectGetHeight(self.view.frame) > CGRectGetWidth(self.view.frame);
476+
return CGRectGetHeight(self.view.bounds) > CGRectGetWidth(self.view.bounds);
472477
}
473478

474479
#pragma mark - Private
@@ -672,8 +677,8 @@ - (void)updateMaskRect
672677
{
673678
switch (self.cropMode) {
674679
case RSKImageCropModeCircle: {
675-
CGFloat viewWidth = CGRectGetWidth(self.view.frame);
676-
CGFloat viewHeight = CGRectGetHeight(self.view.frame);
680+
CGFloat viewWidth = CGRectGetWidth(self.view.bounds);
681+
CGFloat viewHeight = CGRectGetHeight(self.view.bounds);
677682

678683
CGFloat diameter;
679684
if ([self isPortraitInterfaceOrientation]) {
@@ -691,8 +696,8 @@ - (void)updateMaskRect
691696
break;
692697
}
693698
case RSKImageCropModeSquare: {
694-
CGFloat viewWidth = CGRectGetWidth(self.view.frame);
695-
CGFloat viewHeight = CGRectGetHeight(self.view.frame);
699+
CGFloat viewWidth = CGRectGetWidth(self.view.bounds);
700+
CGFloat viewHeight = CGRectGetHeight(self.view.bounds);
696701

697702
CGFloat length;
698703
if ([self isPortraitInterfaceOrientation]) {

iphone/RSKImageCropper/RSKImageCropper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// RSKImageCropper.h
33
//
4-
// Copyright (c) 2014 Ruslan Skorb, http://ruslanskorb.com/
4+
// Copyright (c) 2014-present Ruslan Skorb, http://ruslanskorb.com/
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to deal

iphone/RSKImageCropper/RSKTouchView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// RSKTouchView.h
33
//
4-
// Copyright (c) 2014 Ruslan Skorb, http://ruslanskorb.com/
4+
// Copyright (c) 2014-present Ruslan Skorb, http://ruslanskorb.com/
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to deal

iphone/RSKImageCropper/RSKTouchView.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// RSKTouchView.m
33
//
4-
// Copyright (c) 2014 Ruslan Skorb, http://ruslanskorb.com/
4+
// Copyright (c) 2014-present Ruslan Skorb, http://ruslanskorb.com/
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to deal

iphone/RSKImageCropper/UIImage+RSKImageCropper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// UIImage+RSKImageCropper.h
33
//
4-
// Copyright (c) 2014 Ruslan Skorb, http://ruslanskorb.com/
4+
// Copyright (c) 2014-present Ruslan Skorb, http://ruslanskorb.com/
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to deal

iphone/RSKImageCropper/UIImage+RSKImageCropper.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// UIImage+RSKImageCropper.m
33
//
4-
// Copyright (c) 2014 Ruslan Skorb, http://ruslanskorb.com/
4+
// Copyright (c) 2014-present Ruslan Skorb, http://ruslanskorb.com/
55
//
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
77
// of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)