How to use “open in…” feature to iOS app?

后端 未结 3 1322
迷失自我
迷失自我 2020-12-15 12:40

I\'m not looking to add my app to the \"open in...\" list, but to get the list itself. And sending the file to another app.

I\'m working on internal communication ap

相关标签:
3条回答
  • Another option :

    use UIActivityViewController as available from iOS 6.0 > version

    //create instance with file URL
    UIActivityViewController *activity = [[UIActivityViewController alloc] initWithActivityItems:@[fileURLHere] applicationActivities:nil];
    //present it
    [self presentViewController:activity animated:YES completion:NULL];
    

    Note : There might be problem using UIDocumentInteractionController. Check uidocumentinteractioncontroller-stopped-working-ios-8

    0 讨论(0)
  • 2020-12-15 13:02

    Look at UIDocumentInteractionController https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIDocumentInteractionController_class/Reference/Reference.html and here https://developer.apple.com/library/ios/#documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/OpeningSupportedFileTypes.html#//apple_ref/doc/uid/TP40010412-SW1

    0 讨论(0)
  • 2020-12-15 13:05
    UIDocumentInteractionController *controller = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:appFile]];
            self.controller.delegate = self;
    CGRect navRect = self.view.frame;
    [self.controller presentOptionsMenuFromRect:navRect inView:self.view animated:YES];
    

    Implement following UIDocumentInteractionControllerDelegate methods

    #pragma mark - UIDocumentInteractionControllerDelegate
    
    //===================================================================
    - (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
    {
        return self;
    }
    
    - (UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller
    {
        return self.view;
    }
    
    - (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller
    {
        return self.view.frame;
    }
    
    0 讨论(0)
提交回复
热议问题