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