Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found Michael Kuntscher answer to be right on target. A slight modification is necessary if the UIDocumentInteractionController is presented from a popover.</p> <p>There is a slight dependence on the view hierarchy that can be eliminated by iterating over the parent views until one with a UIWindow superview is found. In addition, I found that when a document interaction controller is presented from within a popover it is slightly different views that need to be stored as the parentView and containerView (specifically we want to find a containerView such that its superview is a UIPopoverView). The following snippet is a re-worked version of Michael's answer to incorporate these changes (note that UIPopoverView is a private class, so we use string representations of the class rather than making a direct reference to each class):</p> <pre><code>- (void)documentInteractionControllerWillBeginPreview:(UIDocumentInteractionController *)controller { /* iOS 7 DIC bug workaround */ if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM()) { UIView *a_view = self.view; self.dicParentView = nil; self.dicContainerView = nil; while (a_view != nil) { UIView *super_super_view = [[a_view superview] superview]; NSString *str_class = NSStringFromClass([super_super_view class]); if ([str_class isEqualToString:@"UIWindow"] || [str_class hasSuffix:@"PopoverView"]) { self.dicParentView = a_view; self.dicContainerView = [a_view superview]; break; } a_view = [a_view superview]; } if (self.dicParentView == nil) { NSLog(@"Could not appropriate superview, unable to workaround DIC bug"); } } /* end work around */ } - (void)documentInteractionControllerDidEndPreview:(__unused UIDocumentInteractionController *)controller { /* iOS 7 DIC bug workaround */ if (UIUserInterfaceIdiomPad == UI_USER_INTERFACE_IDIOM()) { if ((self.view.window == nil) &amp;&amp; (self.dicContainerView != nil) &amp;&amp; (self.dicParentView != nil)) { NSLog(@"Restoring view for DIC presenter in the view hierarchy"); CGRect frame = self.dicParentView.frame; frame.origin = CGPointZero; self.dicParentView.frame = frame; [self.dicContainerView addSubview: self.dicParentView]; self.dicContainerView = nil; self.dicParentView = nil; } } /* end work around */ } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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