Skip to content

Commit 50ca51e

Browse files
authored
Merge pull request #631 from yeseni-today/fix/fix-layout-with-windowingControl
Fix toolbar cover on iPadOS26 top-left windowingControl area.
2 parents 2ca96ce + 0dd095f commit 50ca51e

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
@@ -270,6 +270,17 @@ - (UIRectEdge)preferredScreenEdgesDeferringSystemGestures {
270270

271271
- (CGRect)frameForToolbarWithVerticalLayout:(BOOL)verticalLayout {
272272
UIEdgeInsets insets = self.statusBarSafeInsets;
273+
274+
// fix: On iOS 26, overlay with iPadOS windowingControl area.
275+
if (@available(iOS 26.0, *)) {
276+
if (!verticalLayout) {
277+
UIViewLayoutRegion *layoutRegion = [UIViewLayoutRegion safeAreaLayoutRegionWithCornerAdaptation: UIViewLayoutRegionAdaptivityAxisVertical];
278+
UIEdgeInsets edgeInsets = [self.view edgeInsetsForLayoutRegion:layoutRegion];
279+
insets.top = edgeInsets.top;
280+
insets.left = edgeInsets.left;
281+
insets.bottom = edgeInsets.bottom;
282+
}
283+
}
273284

274285
CGRect frame = CGRectZero;
275286
if (!verticalLayout) { // In landscape laying out toolbar to the left
@@ -279,10 +290,10 @@ - (CGRect)frameForToolbarWithVerticalLayout:(BOOL)verticalLayout {
279290
#else
280291
CGFloat minPadding = 16.0f;
281292
#endif
282-
frame.origin.x = insets.left + minPadding;
283-
frame.origin.y = minPadding;
293+
frame.origin.x = insets.left;
294+
frame.origin.y = minPadding + insets.top;
284295
frame.size.width = kTOCropViewControllerToolbarHeight;
285-
frame.size.height = CGRectGetHeight(self.view.frame) - (minPadding * 2.0f);
296+
frame.size.height = CGRectGetHeight(self.view.frame) - (minPadding * 2.0f) - insets.top - insets.bottom;
286297
} else {
287298
frame.origin.x = insets.left;
288299
frame.origin.y = 0.0f;

0 commit comments

Comments
 (0)