【问题标题】:Open Instagram only in UIDocumentInteractionController仅在 UIDocumentInteractionController 中打开 Instagram
【发布时间】:2015-04-01 09:15:39
【问题描述】:

我的应用程序需要将图像发布到 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按下。

【问题讨论】:

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


    【解决方案1】:
    1. 为什么我的UIDocumentInteractionController 显示其他选项?

      如果您使用的是来自 Internet 的一些代码 sn-p,请确保您正确实现了委托方法。

      -(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

    【讨论】:

    • 感谢@ChengYu Hsu 我已经解决了我的第一个问题,现在 airDrop 只显示 Instagram。试图解决我的第二个问题。
    • 在 swift 中这个相当于什么?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多