草庐IT

ios - UIDocumentInteractionController 没有出现在 iPad 上但在 iPhone 上工作

coder 2024-01-14 原文

我正在尝试在我的应用程序上显示一个 UIDocumentInteractionController。一切在 iPhone 上运行完美,但在 iPad 上什么也没有发生。这是我的代码:

    interactionController = [UIDocumentInteractionController interactionControllerWithURL:imageFile];
    interactionController.UTI = @"com.instagram.photo";
    interactionController.annotation = [NSDictionary dictionaryWithObject:[self commentForInstagram] forKey:@"InstagramCaption"];
    [interactionController presentOpenInMenuFromRect:self.view.frame inView:self.view animated:YES];

interactionController是实例的强引用,imageFile存在。在 iPhone 上,它会弹出“打开方式...”对话框,并且会显示 Instagram。在 iPad 上,上面的代码运行时绝对没有任何反应。是的,我确实在我的 iPad 上安装了 Instagram 并且可以正常工作。

执行代码时没有发生任何事情的原因可能是什么? self.viewself.view.frame 是有效对象(在调试时测试)。

谢谢,Can。

最佳答案

在 iPad 上 UIDocumentInteractionController 显示为 Pop Up 尝试这样的事情:

-(void)shareClick:(UIButton*)sender {
   /*some code*/
   CGRect rectForAppearing = [sender.superview convertRect:sender.frame toView:self.view];
   [interactionController presentOptionsMenuFromRect:rect inView:self.view animated:YES];
}

关于ios - UIDocumentInteractionController 没有出现在 iPad 上但在 iPhone 上工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18091485/

有关ios - UIDocumentInteractionController 没有出现在 iPad 上但在 iPhone 上工作的更多相关文章

随机推荐