@@ -406,7 +406,7 @@ - (void)scrollEventOccurred:(UIPanGestureRecognizer*)gesture {
406406 UIWindow* window = [[UIApplication sharedApplication ] keyWindow ];
407407 if (@available (iOS 11.0 , *)) {
408408 UIEdgeInsets insets = window.safeAreaInsets ;
409- return juce::BorderSize<int >(insets.top + (isIPad () ? 26 : 0 ), insets.left , insets.bottom , insets.right );
409+ return juce::BorderSize<int >(insets.top + (isIPad () ? 26 : 0 ), insets.left , insets.bottom + ( isIPad () ? - 20 : 0 ) , insets.right );
410410 }
411411
412412 // Fallback for older iOS versions or devices without safeAreaInsets
@@ -438,55 +438,55 @@ - (void)scrollEventOccurred:(UIPanGestureRecognizer*)gesture {
438438 UIAlertController *alertController = [UIAlertController alertControllerWithTitle: @" Main Menu"
439439 message: nil
440440 preferredStyle: UIAlertControllerStyleActionSheet];
441-
441+
442442 UIAlertAction *themeAction = [UIAlertAction actionWithTitle: @" Select Theme..."
443- style: UIAlertActionStyleDefault
444- handler: ^(UIAlertAction * _Nonnull action) {
445- // Create a second UIAlertController for the submenu
446- UIAlertController *submenu = [UIAlertController alertControllerWithTitle: @" Themes"
447- message: nil
448- preferredStyle: UIAlertControllerStyleActionSheet];
449-
450- // Add actions for the submenu
451- UIAlertAction *subAction1 = [UIAlertAction actionWithTitle: @" First Theme (Light)"
452- style: UIAlertActionStyleDefault
453- handler: ^(UIAlertAction * _Nonnull action) {
454- callback (7 );
455- }];
456-
457- UIAlertAction *subAction2 = [UIAlertAction actionWithTitle: @" Second Theme (dark)"
458- style: UIAlertActionStyleDefault
459- handler: ^(UIAlertAction * _Nonnull action) {
460- callback (8 );
461- }];
462-
463- UIAlertAction *cancelAction = [UIAlertAction actionWithTitle: @" Cancel"
464- style: UIAlertActionStyleCancel
465- handler: ^(UIAlertAction * _Nonnull action) {
466- callback (-1 );
467- }];
443+ style: UIAlertActionStyleDefault
444+ handler: ^(UIAlertAction * _Nonnull action) {
445+ // Create a second UIAlertController for the submenu
446+ UIAlertController *submenu = [UIAlertController alertControllerWithTitle: @" Themes"
447+ message: nil
448+ preferredStyle: UIAlertControllerStyleActionSheet];
468449
469- if (isIPad ())
470- {
471-
472- submenu.preferredContentSize = view.frame .size ;
473-
474- if (auto * popoverController = submenu.popoverPresentationController )
475- {
476- popoverController.sourceView = view;
477- popoverController.sourceRect = CGRectMake (35 .0f , 1 .0f , 50 .0f , 50 .0f );
478- popoverController.canOverlapSourceViewRect = YES ;
479- }
480- }
450+ // Add actions for the submenu
451+ UIAlertAction *subAction1 = [UIAlertAction actionWithTitle: @" First Theme (Light)"
452+ style: UIAlertActionStyleDefault
453+ handler: ^(UIAlertAction * _Nonnull action) {
454+ callback (7 );
455+ }];
481456
482- [submenu addAction: subAction1];
483- [submenu addAction: subAction2];
484- [submenu addAction: cancelAction];
457+ UIAlertAction *subAction2 = [UIAlertAction actionWithTitle: @" Second Theme (dark)"
458+ style: UIAlertActionStyleDefault
459+ handler: ^(UIAlertAction * _Nonnull action) {
460+ callback (8 );
461+ }];
485462
486-
487- // Present the submenu
488- [viewController presentViewController: submenu animated: YES completion: nil ];
489- }];
463+ UIAlertAction *cancelAction = [UIAlertAction actionWithTitle: @" Cancel"
464+ style: UIAlertActionStyleCancel
465+ handler: ^(UIAlertAction * _Nonnull action) {
466+ callback (-1 );
467+ }];
468+
469+ if (isIPad ())
470+ {
471+
472+ submenu.preferredContentSize = view.frame .size ;
473+
474+ if (auto * popoverController = submenu.popoverPresentationController )
475+ {
476+ popoverController.sourceView = view;
477+ popoverController.sourceRect = CGRectMake (35 .0f , 1 .0f , 50 .0f , 50 .0f );
478+ popoverController.canOverlapSourceViewRect = YES ;
479+ }
480+ }
481+
482+ [submenu addAction: subAction1];
483+ [submenu addAction: subAction2];
484+ [submenu addAction: cancelAction];
485+
486+
487+ // Present the submenu
488+ [viewController presentViewController: submenu animated: YES completion: nil ];
489+ }];
490490
491491
492492 UIAlertAction *newPatchAction = [UIAlertAction actionWithTitle: @" New Patch"
@@ -539,7 +539,6 @@ - (void)scrollEventOccurred:(UIPanGestureRecognizer*)gesture {
539539
540540 if (isIPad ())
541541 {
542-
543542 alertController.preferredContentSize = view.frame .size ;
544543
545544 if (auto * popoverController = alertController.popoverPresentationController )
@@ -623,7 +622,6 @@ - (void)scrollEventOccurred:(UIPanGestureRecognizer*)gesture {
623622
624623 if (isIPad ())
625624 {
626-
627625 alertController.preferredContentSize = view.frame .size ;
628626
629627 if (auto * popoverController = alertController.popoverPresentationController )
0 commit comments