Files
ANSLIB/MediaClient/MediaClientForMobile/ios/ios_launcher.mm
2026-03-28 11:39:04 +11:00

32 lines
973 B
Plaintext

#include "ios_launcher.h"
#include "file_view_controller.h"
#include <QString>
#import <UIKit/UIDocumentInteractionController.h>
bool iosLaunchFile(QString file)
{
NSString* url = file.toNSString();
NSURL* fileURL = [NSURL fileURLWithPath:url];
static DocViewController* mtv = nil;
if (mtv!=nil)
{
[mtv removeFromParentViewController];
[mtv release];
}
UIDocumentInteractionController* documentInteractionController = nil;
documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
UIViewController* rootv = [[[[UIApplication sharedApplication]windows] firstObject]rootViewController];
if (rootv!=nil)
{
mtv = [[DocViewController alloc] init];
[rootv addChildViewController:mtv];
documentInteractionController.delegate = mtv;
[documentInteractionController presentPreviewAnimated:NO];
return true;
}
return false;
}