Skip to content

Commit e8a97de

Browse files
authored
Merge pull request #636 from TimOliver/fix-rotation-bug
Fix rotation animation error on iOS 26
2 parents f7dbbf4 + 9698960 commit e8a97de

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Objective-C/TOCropViewController/TOCropViewController.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,12 @@ - (void)viewSafeAreaInsetsDidChange {
489489
- (void)viewDidLayoutSubviews {
490490
[super viewDidLayoutSubviews];
491491

492+
[UIView performWithoutAnimation:^{
493+
self.toolbar.frame = [self frameForToolbarWithVerticalLayout:self.verticalLayout];
494+
[self adjustToolbarInsets];
495+
[self.toolbar setNeedsLayout];
496+
}];
497+
492498
self.cropView.frame = [self frameForCropViewWithVerticalLayout:self.verticalLayout];
493499
[self adjustCropViewInsets];
494500
[self.cropView moveCroppedContentToCenterAnimated:NO];
@@ -502,12 +508,6 @@ - (void)viewDidLayoutSubviews {
502508
self.titleLabel.frame = [self frameForTitleLabelWithSize:self.titleLabel.frame.size verticalLayout:self.verticalLayout];
503509
[self.cropView moveCroppedContentToCenterAnimated:NO];
504510
}
505-
506-
[UIView performWithoutAnimation:^{
507-
self.toolbar.frame = [self frameForToolbarWithVerticalLayout:self.verticalLayout];
508-
[self adjustToolbarInsets];
509-
[self.toolbar setNeedsLayout];
510-
}];
511511
}
512512

513513
#pragma mark - Rotation Handling -

Objective-C/TOCropViewController/Views/TOCropView.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,8 +1709,8 @@ - (CGRect)contentBounds {
17091709
CGRect contentRect = CGRectZero;
17101710
contentRect.origin.x = self.cropViewPadding + self.cropRegionInsets.left;
17111711
contentRect.origin.y = self.cropViewPadding + self.cropRegionInsets.top;
1712-
contentRect.size.width = CGRectGetWidth(self.bounds) - ((self.cropViewPadding * 2) + self.cropRegionInsets.left + self.cropRegionInsets.right);
1713-
contentRect.size.height = CGRectGetHeight(self.bounds) - ((self.cropViewPadding * 2) + self.cropRegionInsets.top + self.cropRegionInsets.bottom);
1712+
contentRect.size.width = CGRectGetWidth(self.frame) - ((self.cropViewPadding * 2) + self.cropRegionInsets.left + self.cropRegionInsets.right);
1713+
contentRect.size.height = CGRectGetHeight(self.frame) - ((self.cropViewPadding * 2) + self.cropRegionInsets.top + self.cropRegionInsets.bottom);
17141714
return contentRect;
17151715
}
17161716

0 commit comments

Comments
 (0)