QLPreviewController 自定义标题
2016-10-26 本文已影响128人
Misaki_yuyi
QLPreviewItem的previewItemTitle是readOnly,所以QLPreviewController自定义标题可以通过定制PreviewItem类来实现,新建一个QLPreviewItemCustom继承自NSObject:
#import <Foundation/Foundation.h>
#import <QuickLook/QuickLook.h>
@interface QLPreviewItemCustom : NSObject <QLPreviewItem>
@property (nonatomic,readwrite) NSURL * previewItemURL;
@property (nonatomic,readwrite) NSString * previewItemTitle;
@end
然后在previewController返回QLPreviewItem里面重载
- (id<QLPreviewItem>)previewController:(QLPreviewController*)controller previewItemAtIndex:(NSInteger)index
{
QLPreviewItemCustom * previewItem = [QLPreviewItemCustom new];
previewItem.previewItemTitle = @"Title";
previewItem.previewItemURL = self.pdfURL;
return previewItem;
}