mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-17 09:10:30 +00:00
Fix screen rotation
This commit is contained in:
parent
4ae549822a
commit
77fe3d51f1
@ -347,6 +347,13 @@ public func nativeWindowHostView() -> (UIWindow & WindowHost, WindowHostView, UI
|
||||
rootViewController.viewDidAppear(false)
|
||||
|
||||
let aboveStatusbarWindow = AboveStatusBarWindow(frame: UIScreen.main.bounds)
|
||||
aboveStatusbarWindow.supportedOrientations = { [weak rootViewController] in
|
||||
if let rootViewController = rootViewController {
|
||||
return rootViewController.supportedInterfaceOrientations
|
||||
} else {
|
||||
return .portrait
|
||||
}
|
||||
}
|
||||
|
||||
let hostView = WindowHostView(containerView: rootViewController.view, eventView: window, aboveStatusBarView: rootViewController.view, isRotating: {
|
||||
return window.isRotating()
|
||||
|
@ -36,4 +36,6 @@ void applyKeyboardAutocorrection();
|
||||
|
||||
@interface AboveStatusBarWindow : UIWindow
|
||||
|
||||
@property (nonatomic, copy) UIInterfaceOrientationMask (^ _Nullable supportedOrientations)(void);
|
||||
|
||||
@end
|
||||
|
@ -311,6 +311,8 @@ void applyKeyboardAutocorrection() {
|
||||
|
||||
@interface AboveStatusBarWindowController : UIViewController
|
||||
|
||||
@property (nonatomic, copy) UIInterfaceOrientationMask (^ _Nullable supportedOrientations)(void);
|
||||
|
||||
@end
|
||||
|
||||
@implementation AboveStatusBarWindowController
|
||||
@ -330,6 +332,10 @@ void applyKeyboardAutocorrection() {
|
||||
[self viewDidLoad];
|
||||
}
|
||||
|
||||
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
|
||||
return UIInterfaceOrientationMaskPortrait;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation AboveStatusBarWindow
|
||||
@ -348,6 +354,11 @@ void applyKeyboardAutocorrection() {
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setSupportedOrientations:(UIInterfaceOrientationMask (^)(void))supportedOrientations {
|
||||
_supportedOrientations = [supportedOrientations copy];
|
||||
((AboveStatusBarWindowController *)self.rootViewController).supportedOrientations = _supportedOrientations;
|
||||
}
|
||||
|
||||
- (BOOL)shouldAffectStatusBarAppearance {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user