#include "ios_launcher.h" #include "file_view_controller.h" #include #import 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; }