5

I use UIDocumentInteractionController to share data with other apps on device

 self.docInteraction = [UIDocumentInteractionController interactionControllerWithURL:imageAttachFile];
 self.docInteraction.delegate = self;
 [self.docInteraction presentOpenInMenuFromRect:CGRectZero inView: self.view animated: YES ];

It works nice, but it disappears after device rotation. What is the reason of it and how to fix this?

B.S.
  • 21,660
  • 14
  • 87
  • 109
  • I had problems using `presentOpenInMenuFromRect:CGRectZero` on iOS 6. Replacing `CGRectZero` by a "real" rectangle or using `presentOpenInMenuFromBarButtonItem:` worked better. – Martin R Mar 14 '13 at 11:48
  • And i have no bar buttons? Yes it writes that presenting from rect will be deprecated, but i think the problem that it disappears is not connected with presenting method. – B.S. Mar 14 '13 at 11:50

1 Answers1

0

This seems to be UIDocumentInteractionController's default behaviour, which I'm also looking how to override. But a work around I did was detect device' orientation change by one of the methods listed here: Detecting iOS orientation change instantly and again present your self.docInteraction on rotation.

Also if you intend to use presentOptionsMenuFromRect instead of presentOpenInMenuFromRect someday in future, you'll also have to separately handle same positioning issue with the [UIPrintInteractionController sharedPrintController].

Don't know whether it's the proper solution or not, but at least it'll serve your purpose :)

Community
  • 1
  • 1
cirronimbo
  • 909
  • 9
  • 19