4

Is there a way to use one of 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?

Plato
  • 89
  • 1
  • 11

1 Answers1

3

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;
}
Mongo
  • 2,674
  • 1
  • 20
  • 22
  • Yeah that seems to be the only way I found to do it as well. The other way I handled it was in portrait mode...where I just present it modally – valheru Oct 03 '12 at 20:33