Hello everyone< /p>
I want to know if anyone can help me here, I believe this may just be an iPad-related bug (it works on the iPhone), but it needs confirmation before I submit it.
< p>In order to make UIDocumentInteractionController work in the navigation controller, I followed the recommended method to return to the navigation controller form documentInteractionControllerViewControllerForPreview, but it did not work.
I even tried to upgrade the UIDocumentInteractionController code sample provided by Apple to the iPad , Sure enough, even if I return to the navigation controller from documentInteractionControllerViewControllerForPreview, the document interaction controller will be displayed modally. But for the iPhone, it is indeed pushed into the navigation stack.
I tried to design a The splitviewcontroller application uses the doc interactive controller to read the PDF file, so that the PDF will be displayed in the DetailViewController, but this only applies to QLPreviewController (not the Doc interactive controller).
Does anyone have this problem? ? I put the following sample code in the image I saw:
I am using the iOS 6.0 SDK.
static NSString* documents2[] =
{
@"PDF Document.pdf"
};
@implementation WhizTBViewController
@synthesize documentURLs, docInteractionController;
#pragma mark -
#pragma mark View Controller
- (void)setupDocumentControllerWithURL:(NSURL *)url
{
if (self. docInteractionController == nil)
{
self.docInteractionController = [UIDocumentInteractionController interactionControllerWithURL:url];
self.docInteractionController.delegate = self;
}
else
{
self.docInteractionController.URL = url;
}
}
- (void)previewDocument {
// three ways to present a preview:
// 1. Don't implement this method and simply attach the canned gestureRecognizers to the cell
//
// 2. Don't use canned gesture recognizers and simply use UIDoc umentInteractionController's
// presentPreviewAnimated: to get a preview for the document associated with this cell
//
// 3. Use the QLPreviewController to give the user preview access to the document associated
// with this cell and all the other documents as well.
// for case 2 use this, allowing UIDocumentInteractionController to handle the preview:
NSURL *fileURL;
< br /> fileURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:documents[0] ofType:nil]];
[self setupDocumentControllerWithURL:fileURL];
[self.docInteractionController presentPreviewAnimated:YES];
}
#pragma mark -
#pragma mark UIDocumentInteractionControllerDelegate
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)interactionController
{
return [self navigationController];
}
This is what I see on the iPad
I need to show it like this (the same sample code on the iPhone)