From e461d93e8eda42f50314b9371f4c8414a0a4cc08 Mon Sep 17 00:00:00 2001 From: Salman Alshamrani Date: Tue, 21 Jan 2025 03:21:59 -0500 Subject: [PATCH] Fix file presentation on iPadOS not working --- osu.Framework.iOS/IOSFilePresenter.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/osu.Framework.iOS/IOSFilePresenter.cs b/osu.Framework.iOS/IOSFilePresenter.cs index b697e897e..e69e88ade 100644 --- a/osu.Framework.iOS/IOSFilePresenter.cs +++ b/osu.Framework.iOS/IOSFilePresenter.cs @@ -3,6 +3,7 @@ using System; using System.IO; +using CoreGraphics; using Foundation; using UIKit; using UniformTypeIdentifiers; @@ -26,16 +27,24 @@ namespace osu.Framework.iOS if (documentInteraction.PresentPreview(true)) return true; + // Since file menus on iPadOS appear in a popover-like style, UIDocumentInteractionController requires specifying + // a rectangle in the present functions to display the menu as a popover around that rectangle. + // Ultimately, we want to be given a rectangle by the game so the popover doesn't look out of place, + // but for the time being, specify CGRectZero to make the popover display at the top left. var gameView = window.ViewController.View!; - return documentInteraction.PresentOpenInMenu(gameView.Bounds, gameView, true); + return documentInteraction.PresentOpenInMenu(CGRect.Empty, gameView, true); } public bool PresentFile(string filename) { setupViewController(filename); + // Since file menus on iPadOS appear in a popover-like style, UIDocumentInteractionController requires specifying + // a rectangle in the present functions to display the menu as a popover around that rectangle. + // Ultimately, we want to be given a rectangle by the game so the popover doesn't look out of place, + // but for the time being, specify CGRectZero to make the popover display at the top left. var gameView = window.ViewController.View!; - return documentInteraction.PresentOptionsMenu(gameView.Bounds, gameView, true); + return documentInteraction.PresentOptionsMenu(CGRect.Empty, gameView, true); } private void setupViewController(string filename)