Skip to content

Commit 0dd095f

Browse files
committed
Fix toolbar corved on iPadOS26 top-left windowingControl area.
1 parent 15a88f8 commit 0dd095f

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

Objective-C/TOCropViewController/TOCropViewController.m

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,17 @@ - (UIRectEdge)preferredScreenEdgesDeferringSystemGestures
282282
- (CGRect)frameForToolbarWithVerticalLayout:(BOOL)verticalLayout
283283
{
284284
UIEdgeInsets insets = self.statusBarSafeInsets;
285+
286+
// fix: On iOS 26, overlay with iPadOS windowingControl area.
287+
if (@available(iOS 26.0, *)) {
288+
if (!verticalLayout) {
289+
UIViewLayoutRegion *layoutRegion = [UIViewLayoutRegion safeAreaLayoutRegionWithCornerAdaptation: UIViewLayoutRegionAdaptivityAxisVertical];
290+
UIEdgeInsets edgeInsets = [self.view edgeInsetsForLayoutRegion:layoutRegion];
291+
insets.top = edgeInsets.top;
292+
insets.left = edgeInsets.left;
293+
insets.bottom = edgeInsets.bottom;
294+
}
295+
}
285296

286297
CGRect frame = CGRectZero;
287298
if (!verticalLayout) { // In landscape laying out toolbar to the left
@@ -291,10 +302,10 @@ - (CGRect)frameForToolbarWithVerticalLayout:(BOOL)verticalLayout
291302
#else
292303
CGFloat minPadding = 16.0f;
293304
#endif
294-
frame.origin.x = insets.left + minPadding;
295-
frame.origin.y = minPadding;
305+
frame.origin.x = insets.left;
306+
frame.origin.y = minPadding + insets.top;
296307
frame.size.width = kTOCropViewControllerToolbarHeight;
297-
frame.size.height = CGRectGetHeight(self.view.frame) - (minPadding * 2.0f);
308+
frame.size.height = CGRectGetHeight(self.view.frame) - (minPadding * 2.0f) - insets.top - insets.bottom;
298309
} else {
299310
frame.origin.x = insets.left;
300311
frame.origin.y = 0.0f;

0 commit comments

Comments
 (0)