2

I know QLPreviewController could do this. But it's full screen, my requirement is preview files in a subview.

I tried use a offline window to present the QLPreviewController, and then make a screenshot of the offline window.

The problem is i have to show the window, otherwise the screen shot doesn't catch any thing.

Then my question could be, how to make screen shot for offline window in ios ?

Or you may have better ideas of implement file preview in another way.

Any tips will be appreciated.

jim.huang
  • 1,052
  • 2
  • 9
  • 14

1 Answers1

2

QLPreviewController can be in a subview.

I self use it in a spliview and a subclassed QLPreviewController.

- (void)tableView:(UITableView *)tView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    DocumentViewController *documentViewController = [DocumentViewController new];

    [self.navigationController pushViewController:documentViewController animated:YES];
    [documentViewController release];
}

where DocumentViewController is a subclass of QLPreviewController:

@interface DocumentViewController : QLPreviewController <QLPreviewControllerDataSource>

@implementation DocumentViewController

...
- (id)init
{
    self = [super init];
    if (self) 
    {
        self.dataSource = self;
        self.delegate = self;
    }
    return self;
}
...

and implement the methods witch you want (numberOfPreviewItemsInPreviewController is required for the datasource)

Justin
  • 2,960
  • 2
  • 34
  • 48