2012-10-24 12 views
8

iPad nur: UIDocumentInteractionController presentPreviewAnimated nicht in den Navigationsstapel geschoben und nur modal auch angezeigt, wenn eine Navigationssteuerung von documentInteractionControllerViewControllerForPreview zurückgegebenMögliche Fehler auf iPad für UIDocumentInteractionController: presentPreviewAnimated nicht in den Navigationsstapel geschoben

Hallo Alle

Ich frage mich, ob jemand mir hier helfen könnte und ich glaube, dass dies ein Fehler nur mit dem iPad sein könnte (es funktioniert auf dem iPhone), wollte aber Bestätigung, bevor ich dies ablege.

Um UIDocumentInteractionController in einem Navigationscontroller arbeiten zu lassen, befolgte ich den empfohlenen Ansatz, indem ich ein Navigationscontrollerformular documentInteractionControllerViewControllerForPreview zurückgab, aber es funktioniert nicht.

Ich probierte sogar das von Apple bereitgestellte UIDocumentInteractionController-Codebeispiel aus, indem ich es auf iPad upgraden konnte und der Dokumentinteraktionscontroller wird modal angezeigt, auch wenn ich einen Navigationscontroller von documentInteractionControllerViewControllerForPreview zurücksende. Für das iPhone wird es jedoch in den Navigationsstapel verschoben.

Ich versuche eine splitviewcontroller basierte App zu entwickeln, die PDF-Dateien mit dem Doc Interaction Controller liest, so dass die PDF im DetailViewController angezeigt wird, aber dies funktioniert nur für QLPreviewController (nicht für den Doc Interaction Controller).

Hat jemand Probleme damit? Ich habe meinen Beispielcode unten mit einem Bild von dem, was ich sehe, eingefügt:

Im mit 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 UIDocumentInteractionController'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; 

    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]; 
} 

Dies ist, was ich auf dem iPad sehe

This is what I see on the iPad Ich brauche es so (gleichen Beispielcode auf dem iPhone) zu zeigen, bis

I need to show it up like this (same sample code on the iPhone):

+0

Ich habe ein einfaches Beispielprojekt erstellt, das das Problem veranschaulicht: https://github.com/kristopherjohnson/DocumentPreviewTest –

Antwort

2

ich einen Fehler eingereicht Bericht an Apple. Mein Bericht (http://www.openradar.me/radar?id=2785401) wurde als Duplicate of Bug ID # 12567789 geschlossen. Offensichtlich ist dies ein bekanntes Problem.