Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I have this same problem when presenting a UIDocumentInteractionController from a view controller presented as a modal form sheet on iPad in iOS 7 (worked fine in iOS 6). </p> <p>It looks like that during the transition from the document interaction controller back to the presenting view controller, the presenting view controller's view is wrapped in a temporary UITransitionView, and then that transition view is being removed from the view hierarchy after the transition is complete, along with the presenting view controller's view, leaving just UIDropShadowView that is the backing view of the modal form sheet visible (the gray box).</p> <p>I worked around the problem by keeping a reference to my presenting view controller's root view (the one just before the drop shadow view in the hierarchy) when the document interaction controller preview will begin, and restoring that view to the hierarchy when the document interaction controller preview has ended.</p> <p>Here's sample code:</p> <pre><code> - (void)documentInteractionControllerWillBeginPreview:(__unused UIDocumentInteractionController *)controller { if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM()) { // work around iOS 7 bug on ipad self.parentView = [[[self.view superview] superview] superview]; self.containerView = [self.parentView superview]; if (![[self.containerView superview] isKindOfClass: [UIWindow class]]) { // our assumption about the view hierarchy is broken, abort self.containerView = nil; self.parentView = nil; } } } - (void)documentInteractionControllerDidEndPreview:(__unused UIDocumentInteractionController *)controller { if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM()) { if (!self.view.window &amp;&amp; self.containerView) { assert(self.parentView); CGRect frame = self.parentView.frame; frame.origin = CGPointZero; self.parentView.frame = frame; [self.containerView addSubview: self.parentView]; self.containerView = nil; self.parentView = nil; } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload