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;
}