QLPreviewController 自定义标题
程序员文章站
2022-07-13 23:14:38
...
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;
}
上一篇: Redmine安装与入门指南
下一篇: QT实现自定义标题栏,并移动