From 9698960f078ddb7fd10b890339013ac1644ed895 Mon Sep 17 00:00:00 2001 From: Tim Oliver Date: Thu, 20 Nov 2025 17:21:34 +0900 Subject: [PATCH] Fix rotation snapping issue --- .../TOCropViewController/TOCropViewController.m | 12 ++++++------ Objective-C/TOCropViewController/Views/TOCropView.m | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Objective-C/TOCropViewController/TOCropViewController.m b/Objective-C/TOCropViewController/TOCropViewController.m index ff399e99..aef0c5da 100644 --- a/Objective-C/TOCropViewController/TOCropViewController.m +++ b/Objective-C/TOCropViewController/TOCropViewController.m @@ -489,6 +489,12 @@ - (void)viewSafeAreaInsetsDidChange { - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; + [UIView performWithoutAnimation:^{ + self.toolbar.frame = [self frameForToolbarWithVerticalLayout:self.verticalLayout]; + [self adjustToolbarInsets]; + [self.toolbar setNeedsLayout]; + }]; + self.cropView.frame = [self frameForCropViewWithVerticalLayout:self.verticalLayout]; [self adjustCropViewInsets]; [self.cropView moveCroppedContentToCenterAnimated:NO]; @@ -502,12 +508,6 @@ - (void)viewDidLayoutSubviews { self.titleLabel.frame = [self frameForTitleLabelWithSize:self.titleLabel.frame.size verticalLayout:self.verticalLayout]; [self.cropView moveCroppedContentToCenterAnimated:NO]; } - - [UIView performWithoutAnimation:^{ - self.toolbar.frame = [self frameForToolbarWithVerticalLayout:self.verticalLayout]; - [self adjustToolbarInsets]; - [self.toolbar setNeedsLayout]; - }]; } #pragma mark - Rotation Handling - diff --git a/Objective-C/TOCropViewController/Views/TOCropView.m b/Objective-C/TOCropViewController/Views/TOCropView.m index 919769e0..7e12ca63 100644 --- a/Objective-C/TOCropViewController/Views/TOCropView.m +++ b/Objective-C/TOCropViewController/Views/TOCropView.m @@ -1709,8 +1709,8 @@ - (CGRect)contentBounds { CGRect contentRect = CGRectZero; contentRect.origin.x = self.cropViewPadding + self.cropRegionInsets.left; contentRect.origin.y = self.cropViewPadding + self.cropRegionInsets.top; - contentRect.size.width = CGRectGetWidth(self.bounds) - ((self.cropViewPadding * 2) + self.cropRegionInsets.left + self.cropRegionInsets.right); - contentRect.size.height = CGRectGetHeight(self.bounds) - ((self.cropViewPadding * 2) + self.cropRegionInsets.top + self.cropRegionInsets.bottom); + contentRect.size.width = CGRectGetWidth(self.frame) - ((self.cropViewPadding * 2) + self.cropRegionInsets.left + self.cropRegionInsets.right); + contentRect.size.height = CGRectGetHeight(self.frame) - ((self.cropViewPadding * 2) + self.cropRegionInsets.top + self.cropRegionInsets.bottom); return contentRect; }