I have a little problem with the use of QLPreviewController. Indeed, I have to display a PDF in my application and this class works fine if I push the controller in the UINavigationController application. For this, I use this tutorial : (http://iosdevelopertips.com/data-file-management/preview-documents-with-qlpreviewcontroller.html).
The problem is that I need a UIToolbar at bottom of the view to accompany the PDF. So I created a new controller with a UIToolBar and a QLPreviewController but the QLPreviewController doesn't appear: my view for the QLPreviewController's view stay white.
This is the initialization code and adding the controller to the view:
PdfReaderViewController = [[QLPreviewController alloc] init];
[PdfReaderViewController setDataSource:self];
[PdfReaderViewController setDelegate:self];
[PdfReaderViewController.view setFrame:myViewForPdfReader.frame];
[PdfReaderViewController setCurrentPreviewItemIndex:sollIndex];
vuePourLecteurPDF = PdfReaderViewController.view;
[PdfReaderViewController reloadData];
I notice that one of two methods... :
- (id <QLPreviewItem>) previewController: (QLPreviewController *) controller previewItemAtIndex: (NSInteger) index;
of the QLPreviewControllerDataSource is not called when reloadData. The second returns a positive integer:
- (NSInteger) numberOfPreviewItemsInPreviewController: (QLPreviewController *) controller;
I don't understand the problem, I know only that both methods are correct because i tested by pushing the QLPreviewController in the UINavigationController.
I read some posts:
Customizing QLPreviewController
Adding QLPreviewController as subview doesn't load PDF
blank QLPreviewController in iOS application
... but this does not help me