- (void)onOpenWith:(UIButton *)theButton path:(NSString *)path
{
NSURL *URL = [NSURL fileURLWithPath:path];
if (URL) {
self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:URL];
self.documentInteractionController.delegate = self;
//self.documentInteractionController.name = @"Title";
//self.documentInteractionController.UTI = @"com.adobe.pdf"; @"net.whatsapp.image";
//Preview PDF
//[self.documentInteractionController presentPreviewAnimated:YES];
//Open In iBooks
//presentOpenInMenuFromRect
//presentOptionsMenuFromRect
[self.documentInteractionController presentOpenInMenuFromRect:CGRectZero
inView:aView
animated:YES];
}
}
#pragma mark - UIDocumentInteractionControllerDelegate
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller
{
return self;
}
- (UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller
{
return self.view;
}
- (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller
{
return self.view.frame;
}
No comments:
Post a Comment