mirror of
https://github.com/zydeco/minivmac4ios.git
synced 2024-09-27 12:59:00 +00:00
fix broken view after interactive sheet dismiss on iOS 13
This commit is contained in:
parent
479b9c243c
commit
21de19443a
@ -13,7 +13,7 @@
|
||||
#import "KBKeyboardView.h"
|
||||
#import "KBKeyboardLayout.h"
|
||||
|
||||
@interface ViewController () <UIViewControllerTransitioningDelegate, UIViewControllerAnimatedTransitioning>
|
||||
@interface ViewController () <UIViewControllerTransitioningDelegate, UIViewControllerAnimatedTransitioning, UIAdaptivePresentationControllerDelegate>
|
||||
|
||||
@end
|
||||
|
||||
@ -74,6 +74,7 @@ API_AVAILABLE(ios(13.4))
|
||||
UISwipeGestureRecognizer *gestureRecognizer = (UISwipeGestureRecognizer*)sender;
|
||||
modalPanePresentationDirection = gestureRecognizer.direction;
|
||||
segue.destinationViewController.transitioningDelegate = self;
|
||||
segue.destinationViewController.presentationController.delegate = self;
|
||||
} else if (self.presentedViewController != nil && [@[@"disk", @"settings"] containsObject:segue.identifier]) {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
@ -116,6 +117,19 @@ API_AVAILABLE(ios(13.4))
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)presentationControllerDidDismiss:(UIPresentationController *)presentationController {
|
||||
// hack to fix the presenting view controller not returning back to normal size on iOS 13
|
||||
// when the sheet is dismissed interactively (ie dragging it down) after a contextual menu
|
||||
// has been shown, which breaks some autolayout constraints. when this happens, the
|
||||
// presenting view controller won't resize back to normal during the interactive
|
||||
// dismissing of the presented sheet
|
||||
if (@available(iOS 14, *)) {
|
||||
// it works correctly on iOS 14
|
||||
} else {
|
||||
self.view.superview.transform = CGAffineTransformIdentity;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)prefersStatusBarHidden {
|
||||
UIScreen *screen = self.view.window.screen;
|
||||
return CGRectEqualToRect(screen.bounds, self.view.window.bounds);
|
||||
|
Loading…
Reference in New Issue
Block a user