Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS - Opening a PDF via Quicklook without using UIScrollView
    primarykey
    data
    text
    <p>I am trying to open a PDF via the QuickLook framework without using UIScrollView...</p> <p>I believe I'm missing something...</p> <p>Where I believe I'm going wrong is that I need to use a QLPreviewController and on the QLPreviewController is a dataSource that has to conform to QLPreviewItem. The documentation states that NSURL does conform to QLPriewItem so I'm setting the preview.dataSource to an NSURL which is throwing an error:</p> <p><strong>[NSURL numberOfPreviewItemsInPreviewController:]: unrecognized selector sent to instance</strong> </p> <p><strong>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSURL numberOfPreviewItemsInPreviewController:]: unrecognized selector sent to instance 0x5b5f200'</strong></p> <p>Which makes me think that NSURL does not conform.</p> <p>all the code I think is necessary...</p> <pre><code>- (BOOL)previewController:(QLPreviewController *)controller shouldOpenURL:(NSURL *)url forPreviewItem:(id &lt;QLPreviewItem&gt;)item { return YES; } - (NSInteger) numberOfPreviewItemsInPreviewController: (QLPreviewController *) controller { return [documents count]; } - (id &lt;QLPreviewItem&gt;) previewController: (QLPreviewController *) controller previewItemAtIndex: (NSInteger) index { return [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:[documents objectAtIndex:index] ofType:nil]]; } - (void)pushPDF { QLPreviewController *preview = [[QLPreviewController alloc] init]; preview.dataSource = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"MCIT_Quiz" ofType:@"pdf"]]; //preview.currentPreviewItemIndex = 0; [self presentModalViewController:preview animated:YES]; [preview release]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload