仅在UIDocumentInteractionController中打开Instagram

时间:2015-04-01 09:15:39

标签: ios objective-c uiimage instagram social-networking

我的应用程序需要将图片发布到Instagram,我使用UIDocumentInteractionController打开保存在Documents directory中的图片文件,其扩展名为.igo。将com.instagram.exclusivegram设置为UIDocumentInteractionController's UTI属性。这一切都很好,我的问题是,当我使用

[dic presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];

要打开UIDocumentInteractionController,它会显示PDF readerDropBox等。我必须隐藏除Instagram之外的其他选项或仅显示Instagram。以及如何在显示的菜单中识别Cancel button按下。

1 个答案:

答案 0 :(得分:1)

  1. 为什么我的UIDocumentInteractionController会显示其他选项?

    如果您正在使用互联网上的某些代码段,请确保正确实施了委托方法。

    -(UIDocumentInteractionController *)setupControllerWithURL:(NSURL *)fileURL 
                                                 usingDelegate:(id<UIDocumentInteractionControllerDelegate>) interactionDelegate 
    {
        // if you're creating a new instance here,
        // make sure you set the properties correctly
        UIDocumentInteractionController *interactionController = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
        // remember to set it again here
        interactionController.UTI = @"com.instagram.exclusivegram";
        interactionController.delegate = interactionDelegate;    
        return interactionController;
    } 
    
  2. 我如何知道用户是取消操作还是进入Instagram?

    请参阅此主题的答案:UIDocumentInteractionController Open Menu Cancelled Callback