diff --git a/Example/RSKImageCropperExample.xcodeproj/project.pbxproj b/Example/RSKImageCropperExample.xcodeproj/project.pbxproj index 8ab6b7f..b8501e4 100644 --- a/Example/RSKImageCropperExample.xcodeproj/project.pbxproj +++ b/Example/RSKImageCropperExample.xcodeproj/project.pbxproj @@ -555,12 +555,12 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_TEAM = J3P7YV7464; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "RSKImageCropperExample/RSKImageCropperExample-Prefix.pch"; INFOPLIST_FILE = "RSKImageCropperExample/RSKImageCropperExample-Info.plist"; - MARKETING_VERSION = 4.1.0; + MARKETING_VERSION = 4.1.1; PRODUCT_BUNDLE_IDENTIFIER = "com.ruslanskorb.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = RSKImageCropperExample; TARGETED_DEVICE_FAMILY = 1; @@ -572,12 +572,12 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 5; + CURRENT_PROJECT_VERSION = 6; DEVELOPMENT_TEAM = J3P7YV7464; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "RSKImageCropperExample/RSKImageCropperExample-Prefix.pch"; INFOPLIST_FILE = "RSKImageCropperExample/RSKImageCropperExample-Info.plist"; - MARKETING_VERSION = 4.1.0; + MARKETING_VERSION = 4.1.1; PRODUCT_BUNDLE_IDENTIFIER = "com.ruslanskorb.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = RSKImageCropperExample; TARGETED_DEVICE_FAMILY = 1; diff --git a/RSKImageCropper.podspec b/RSKImageCropper.podspec index 14bef32..193983e 100644 --- a/RSKImageCropper.podspec +++ b/RSKImageCropper.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'RSKImageCropper' - s.version = '4.1.0' + s.version = '4.1.1' 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' } diff --git a/RSKImageCropper.xcodeproj/project.pbxproj b/RSKImageCropper.xcodeproj/project.pbxproj index cc5a634..80f76a0 100644 --- a/RSKImageCropper.xcodeproj/project.pbxproj +++ b/RSKImageCropper.xcodeproj/project.pbxproj @@ -236,7 +236,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 4.1.0; + CURRENT_PROJECT_VERSION = 4.1.1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -297,7 +297,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 4.1.0; + CURRENT_PROJECT_VERSION = 4.1.1; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -326,8 +326,8 @@ CODE_SIGN_IDENTITY = ""; CURRENT_PROJECT_VERSION = 5; DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 4.1.0; - DYLIB_CURRENT_VERSION = 4.1.0; + DYLIB_COMPATIBILITY_VERSION = 4.1.1; + DYLIB_CURRENT_VERSION = 4.1.1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_MODULE_VERIFIER = YES; INFOPLIST_FILE = Framework/Info.plist; @@ -337,7 +337,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 4.1.0; + MARKETING_VERSION = 4.1.1; MODULEMAP_FILE = "$(SRCROOT)/RSKImageCropper/RSKImageCropper.modulemap"; MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11"; @@ -353,8 +353,8 @@ CODE_SIGN_IDENTITY = ""; CURRENT_PROJECT_VERSION = 5; DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 4.1.0; - DYLIB_CURRENT_VERSION = 4.1.0; + DYLIB_COMPATIBILITY_VERSION = 4.1.1; + DYLIB_CURRENT_VERSION = 4.1.1; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_MODULE_VERIFIER = YES; INFOPLIST_FILE = Framework/Info.plist; @@ -364,7 +364,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - MARKETING_VERSION = 4.1.0; + MARKETING_VERSION = 4.1.1; MODULEMAP_FILE = "$(SRCROOT)/RSKImageCropper/RSKImageCropper.modulemap"; MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++"; MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11"; diff --git a/RSKImageCropper/RSKImageCropViewController.m b/RSKImageCropper/RSKImageCropViewController.m index 97cc352..b763103 100644 --- a/RSKImageCropper/RSKImageCropViewController.m +++ b/RSKImageCropper/RSKImageCropViewController.m @@ -652,7 +652,9 @@ - (void)handleRotation:(UIRotationGestureRecognizer *)gestureRecognizer - (void)zoomToRect:(CGRect)rect animated:(BOOL)animated { - [self.imageScrollView zoomToRect:[self.imageScrollView convertRect:rect fromView:self.view] animated:animated]; + rect = [self.imageScrollView convertRect:rect fromView:self.view]; + rect = [self.imageScrollView convertRect:rect toCoordinateSpace:self.imageScrollView.imageCoordinateSpace]; + [self.imageScrollView zoomToRect:rect animated:animated]; } #pragma mark - Public diff --git a/RSKImageCropper/RSKImageScrollView.h b/RSKImageCropper/RSKImageScrollView.h index 3e76b35..e149d50 100755 --- a/RSKImageCropper/RSKImageScrollView.h +++ b/RSKImageCropper/RSKImageScrollView.h @@ -75,6 +75,11 @@ NS_SWIFT_UI_ACTOR */ @property (nonatomic, nullable, strong) UIColor *imageBackgroundColor; +/** + The coordinate space of the image. + */ +@property (nonatomic, readonly) id imageCoordinateSpace; + /** The current frame of the image in the coordinate space of the image scroll view. */ @@ -107,14 +112,6 @@ NS_SWIFT_UI_ACTOR */ - (void)zoomToLocation:(CGPoint)location animated:(BOOL)animated; -/** - Zooms to a specific area of the image so that it’s visible in the image scroll view. - - @param rect A rectangle defining an area of the image. The rectangle should be in the coordinate space of the image scroll view. - @param animated `YES` if the scrolling should be animated, `NO` if it should be immediate. - */ -- (void)zoomToRect:(CGRect)rect animated:(BOOL)animated; - @end @interface RSKImageScrollView (Deprecated) diff --git a/RSKImageCropper/RSKImageScrollView.m b/RSKImageCropper/RSKImageScrollView.m index d265dad..70e7a45 100755 --- a/RSKImageCropper/RSKImageScrollView.m +++ b/RSKImageCropper/RSKImageScrollView.m @@ -133,6 +133,11 @@ - (void)setImageBackgroundColor:(UIColor *)imageBackgroundColor _imageView.backgroundColor = imageBackgroundColor; } +- (id)imageCoordinateSpace +{ + return [_imageView coordinateSpace]; +} + - (CGRect)imageFrame { return _imageView.frame; @@ -204,13 +209,6 @@ - (void)zoomToLocation:(CGPoint)location animated:(BOOL)animated [self zoomToRect:rect animated:animated]; } -- (void)zoomToRect:(CGRect)rect animated:(BOOL)animated -{ - rect = [_imageView convertRect:rect fromView:self]; - - [super zoomToRect:rect animated:animated]; -} - #pragma mark - UIScrollViewDelegate - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView