1
在我的分割视图控制器中,我在左侧的表视图中有一个文档列表。当用户选择文档时,我想在右侧的详细信息视图中显示文档。但是,当我选择一个文档时,documentInteractionController占据了整个屏幕。我怎样才能让它符合Detail View的大小?在详细视图中显示UIDocumentInteractionController
- (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;
}