Skip to content
This repository has been archived by the owner on Jun 6, 2018. It is now read-only.

Commit

Permalink
Merge pull request #28 from exalted/pdf-view-controller
Browse files Browse the repository at this point in the history
Add UIDocumentInteractionController as PDF viewer.
  • Loading branch information
exalted committed Nov 30, 2013
2 parents 92102f4 + bd8939d commit 96b4caa
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions PTShowcaseViewController/PTShowcaseViewController.m
Expand Up @@ -26,7 +26,9 @@ @interface PTShowcaseView () <GMGridViewDataSource>

@end

@interface PTShowcaseViewController () <GMGridViewActionDelegate, PTImageAlbumViewDataSource>
@interface PTShowcaseViewController () <GMGridViewActionDelegate,
PTImageAlbumViewDataSource,
UIDocumentInteractionControllerDelegate>

- (void)dismissImageDetailViewController;

Expand Down Expand Up @@ -276,18 +278,13 @@ - (void)GMGridView:(GMGridView *)gridView didTapOnItemAtIndex:(NSInteger)positio
}
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

#warning TODO Missing implementation
// PSPDFDocument *document = [PSPDFDocument PDFDocumentWithURL:url];
// document.title = text;
//
// PSPDFViewController *detailViewController = [[PSPDFViewController alloc] initWithDocument:document];
// detailViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
// detailViewController.backgroundColor = self.view.backgroundColor;
//
// UINavigationController *navCtrl = [[UINavigationController alloc] initWithRootViewController:detailViewController];
//
// // TODO zoom in/out (just like in Photos.app in the iPad)
// [self presentViewController:navCtrl animated:YES completion:NULL];
// Initialize Document Interaction Controller
UIDocumentInteractionController *documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:url];
documentInteractionController.name = text;
documentInteractionController.delegate = self;

// Preview PDF
[documentInteractionController presentPreviewAnimated:YES];

break;
}
Expand Down Expand Up @@ -341,6 +338,13 @@ - (NSString *)showcaseView:(PTShowcaseView *)showcaseView pathForItemAtIndex:(NS
abort();
}

#pragma mark - UIDocumentInteractionControllerDelegate

- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
return self;
}

// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

@end

0 comments on commit 96b4caa

Please sign in to comment.