Created
October 27, 2023 15:21
-
-
Save pookjw/303ca03ddc87c46bebb77cf3e123a310 to your computer and use it in GitHub Desktop.
WindowResizability on UIKit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "SceneDelegate.hpp" | |
#import "RootViewController.hpp" | |
#import <objc/message.h> | |
@implementation SceneDelegate | |
- (void)dealloc { | |
[_window release]; | |
[super dealloc]; | |
} | |
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { | |
UIWindowScene *windowScene = static_cast<UIWindowScene *>(scene); | |
// MRUISceneSizeRestrictions | |
id sizeRestrictions = reinterpret_cast<id (*)(id, SEL)>(objc_msgSend)(windowScene, NSSelectorFromString(@"sizeRestrictions")); | |
reinterpret_cast<void (*)(id, SEL, CGRect)>(objc_msgSend)(sizeRestrictions, NSSelectorFromString(@"setMinimumSize:"), CGRectMake(100.f, 100.f, 0.f, 392.f)); | |
reinterpret_cast<void (*)(id, SEL, CGRect)>(objc_msgSend)(sizeRestrictions, NSSelectorFromString(@"setMaximumSize:"), CGRectMake(400.f, 400.f, 0.f, 392.f)); | |
UIWindow *window = [[UIWindow alloc] initWithWindowScene:windowScene]; | |
RootViewController *rootViewController = [RootViewController new]; | |
window.rootViewController = rootViewController; | |
[rootViewController release]; | |
[window makeKeyAndVisible]; | |
self.window = window; | |
[window release]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment