我知道 QLPreviewController 可以做到这一点。但它是全屏的,我的要求是在子视图中预览文件。
我尝试使用离线窗口呈现 QLPreviewController,然后对离线窗口进行截图。
问题是我必须显示窗口,否则屏幕截图不会捕捉到任何东西。
那么我的问题可能是,如何在 ios 中为离线窗口制作屏幕截图?
或者您可能有更好的想法以另一种方式实现文件预览。
任何提示将不胜感激。
我知道 QLPreviewController 可以做到这一点。但它是全屏的,我的要求是在子视图中预览文件。
我尝试使用离线窗口呈现 QLPreviewController,然后对离线窗口进行截图。
问题是我必须显示窗口,否则屏幕截图不会捕捉到任何东西。
那么我的问题可能是,如何在 ios 中为离线窗口制作屏幕截图?
或者您可能有更好的想法以另一种方式实现文件预览。
任何提示将不胜感激。
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)