mirror of
https://github.com/SK-la/osu-framework.git
synced 2026-03-13 11:20:31 +00:00
Fix file presentation on iPadOS not working
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user