开发者

UIDocumentInteractionController / QLPreview with UISplitViewController

Is there a way to use one o开发者_运维技巧f this preview controls with UISplitViewController's detail view..

I'm trying to preview Documents of the application, and made the file browser part.. But the other part still eludes me..

Whatever I did to show preview on a detail view on SplitViewController ended with failure.. Could you help me? How could I achieve this functionality?


I did this by having my detail view controller embedded in a uinavigationcontroller. After creating the QLPreviewController I just pushed the view controller on to the navigation controller.

In the detail view controller:

QLPreviewController *previewController = [[QLPreviewController alloc] init];
[previewController setDataSource:self];
[previewController setDelegate:self];
[self.previewItem setTitle:item.name];
[self.navigationController pushViewController:previewController animated:NO];

The detail view controller also uses the QLPreviewControllerDelegate

- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller {
    return 1;
}

- (id<QLPreviewItem>)previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index {
    return self.previewItem;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜