【问题标题】:How to implement not full screen file preview on ios如何在ios上实现非全屏文件预览
【发布时间】:2011-06-28 14:08:53
【问题描述】:
我知道 QLPreviewController 可以做到这一点。但它是全屏的,我的要求是在子视图中预览文件。
我尝试使用离线窗口呈现QLPreviewController,然后对离线窗口进行截图。
问题是我必须显示窗口,否则屏幕截图无法捕捉到任何东西。
那么我的问题可能是,如何在 ios 中为离线窗口制作屏幕截图?
或者您可能有更好的想法以其他方式实现文件预览。
任何提示将不胜感激。
【问题讨论】:
标签:
ios
file
preview
qlpreviewcontroller
【解决方案1】:
QLPreviewController 可以在子视图中。
我自己在一个 spliview 和一个子类 QLPreviewController 中使用它。
- (void)tableView:(UITableView *)tView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
DocumentViewController *documentViewController = [DocumentViewController new];
[self.navigationController pushViewController:documentViewController animated:YES];
[documentViewController release];
}
其中 DocumentViewController 是 QLPreviewController 的子类:
@interface DocumentViewController : QLPreviewController <QLPreviewControllerDataSource>
@implementation DocumentViewController
...
- (id)init
{
self = [super init];
if (self)
{
self.dataSource = self;
self.delegate = self;
}
return self;
}
...
并实现您想要的方法(数据源需要 numberOfPreviewItemsInPreviewController)