Fix the States view header in iOS 16 and newer

This commit is contained in:
Lior Halphon
2024-02-23 19:58:41 +02:00
parent 5e4a1f6db7
commit 153cdb2e11
2 changed files with 6 additions and 17 deletions

View File

@@ -38,10 +38,8 @@
- (void)viewDidLoad
{
[super viewDidLoad];
UIVisualEffect *effect = [UIBlurEffect effectWithStyle:(UIBlurEffectStyle)UIBlurEffectStyleProminent];
self.view = [[UIVisualEffectView alloc] initWithEffect:effect];
self.view.bounds = CGRectMake(0, 0, 0x300, 0x300);
UIView *root = ((UIVisualEffectView *)self.view).contentView;
UIView *root = self.view;
for (unsigned i = 0; i < 9; i++) {
unsigned x = i % 3;
unsigned y = i / 3;
@@ -115,20 +113,6 @@
[self presentViewController:controller animated:true completion:nil];
}
- (void)viewWillLayoutSubviews
{
[super viewWillLayoutSubviews];
if ([UIDevice currentDevice].userInterfaceIdiom != UIUserInterfaceIdiomPad) {
UIView *root = ((UIVisualEffectView *)self.view).contentView;
CGRect frame = root.frame;
UIEdgeInsets insets = [UIApplication sharedApplication].keyWindow.safeAreaInsets;
frame.size.height = self.view.frame.size.height - insets.bottom;
frame.size.width = self.view.frame.size.width - insets.left - insets.right;
frame.origin.x = insets.left;
root.frame = frame;
}
}
- (NSString *)title
{
return @"Save States";

View File

@@ -426,6 +426,11 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp)
- (void)openStates
{
UINavigationController *controller = [[UINavigationController alloc] initWithRootViewController:[[GBStatesViewController alloc] init]];
UIVisualEffect *effect = [UIBlurEffect effectWithStyle:(UIBlurEffectStyle)UIBlurEffectStyleProminent];
UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:effect];
effectView.frame = controller.view.bounds;
effectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[controller.view insertSubview:effectView atIndex:0];
UIBarButtonItem *close = [[UIBarButtonItem alloc] initWithTitle:@"Close"
style:UIBarButtonItemStylePlain
target:self