Ios 仅在UIDocumentInteractionController中打开Instagram
我的应用程序需要将图像发布到Instagram,我使用Ios 仅在UIDocumentInteractionController中打开Instagram,ios,objective-c,uiimage,instagram,social-networking,Ios,Objective C,Uiimage,Instagram,Social Networking,我的应用程序需要将图像发布到Instagram,我使用UIDocumentInteractionController打开保存在Documents目录中的图像文件,扩展名为.igo。将com.instagram.exclusivegram设置为UIDocumentInteractionController的UTI属性。这一切都很好,我的问题是当我使用 [dic presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
UIDocumentInteractionController
打开保存在Documents目录中的图像文件,扩展名为.igo
。将com.instagram.exclusivegram
设置为UIDocumentInteractionController的
UTI
属性。这一切都很好,我的问题是当我使用
[dic presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
要打开UIDocumentInteractionController
,它会显示PDF阅读器
,DropBox
等。我必须隐藏除Instagram
或仅显示Instagram
之外的其他选项。以及如何识别显示菜单中的取消按钮
UIDocumentInteractionController
显示其他选项
如果您使用的是来自Internet的一些代码片段,请确保正确实现了委托方法
-(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;
}
-(UIDocumentInteractionController*)设置控制器,带URL:(NSURL*)文件URL
usingDelegate:(id)interactionDelegate
{
//如果在此处创建新实例,
//确保正确设置了属性
UIDocumentInteractionController*interactionController=[UIDocumentInteractionController interactionControllerWithURL:fileURL];
//记住在这里再次设置
interactionController.UTI=@“com.instagram.exclusivegram”;
interactionController.delegate=interactionDelegate;
返回交互控制器;
}
谢谢@ChengYu Hsu我已经解决了我的第一个问题,现在空投只显示Instagram。试图解决我的第二个问题。这在swift中是什么意思?