旋转后UIDocumentInteractionController消失

B.S*_*.S. 5 objective-c ios uidocumentinteraction

我用来UIDocumentInteractionController与设备上的其他应用共享数据

 self.docInteraction = [UIDocumentInteractionController interactionControllerWithURL:imageAttachFile];
 self.docInteraction.delegate = self;
 [self.docInteraction presentOpenInMenuFromRect:CGRectZero inView: self.view animated: YES ];
Run Code Online (Sandbox Code Playgroud)

它工作得很好,但它在设备旋转后消失了.它的原因是什么以及如何解决这个问题?

cir*_*mbo 0

这似乎是UIDocumentInteractionController的默认行为,我也在寻找如何覆盖它。但我所做的一项工作是通过此处列出的方法之一检测设备的方向变化: 立即检测 iOS 方向变化 并再次在旋转时呈现您的 self.docInteraction。

另外,如果您打算在将来的某一天使用presentOptionsMenuFromRect而不是presentOpenInMenuFromRect,您还必须使用[UIPrintInteractionController sharedPrintController]单独处理相同的定位问题。

不知道这是否是正确的解决方案,但至少它可以达到您的目的:)