1

In my Split View Controller I have a list of documents in a Table View on the left. When a user selects a document, I want to display the document in the Detail View on the right. However, when I select a document, the documentInteractionController is occupying the entire screen. How can I get it to conform to the size of the Detail View?

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.splitViewController.delegate = self;
}

-(void)viewWillAppear:(BOOL)animated
{
    if (self.selectedUserDoc) {
        NSURL *url = [[NSBundle mainBundle] URLForResource:self.selectedUserDoc.userDocTitle withExtension:@"pdf"];
        self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:url];
        [self.documentInteractionController setDelegate:self];
        [self.documentInteractionController presentPreviewAnimated:YES];
    }
}

- (UIViewController *) documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller {
    return self;
}

-(UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller
{
    return self.view;
}

-(CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller
{
    return self.view.frame;
}
rmaddy
  • 314,917
  • 42
  • 532
  • 579

1 Answers1

0

I just have the some issue. I'm using UIWebView:

 -(void)showDetailDocumentWithUrl:(NSURL*)documentUrl inView:(UIView*):detailView {
   CGRect r;
   r=detailView.frame;
   r.origin.y=75;  // Change frame as required
   .... 
   UIWebView* web=[[UIWebView alloc] initWithFrame:r];
   NSURLRequest *request = [NSURLRequest requestWithURL:documentUrl];
   [web loadRequest:request];
   [detailView addSubview: web];

 }

In my app I do not need further actions as email sending option, but I think you can easily manage them if required.