8

iPadのみ:UIDocumentInteractionController presentPreviewAnimatedはナビゲーションスタックにプッシュされず、ナビゲーションコントローラーがdocumentInteractionControllerViewControllerForPreviewから返された場合でもモーダルでのみ表示されます

こんにちは、みんな

誰かがここで私を助けてくれるだろうかと思います。これはiPadのみに関連するバグである可能性があると思います(iPhoneで動作します)が、これを提出する前に確認が必要でした。

UIDocumentInteractionControllerをナビゲーションコントローラーで機能させるために、ナビゲーションコントローラーフォームdocumentInteractionControllerViewControllerForPreviewを返すことで推奨されるアプローチに従いましたが、機能しません。

Appleが提供するUIDocumentInteractionControllerコードサンプルをiPadにアップグレードして試してみましたが、documentInteractionControllerViewControllerForPreviewからナビゲーションコントローラーを返しても、ドキュメントインタラクションコントローラーはモーダルに表示されます。ただし、iPhoneの場合は、ナビゲーションスタックにプッシュされます。

PDFがDetailViewControllerに表示されるように、docインタラクションコントローラーを使用してPDFファイルを読み取るsplitviewcontrollerベースのアプリを設計しようとしていますが、これはQLPreviewController(Docインタラクションコントローラーではない)でのみ機能します。

誰かがこれに問題がありますか?以下にサンプルコードを、私が見ているものの画像とともに配置しました。

iOS6.0SDKを使用しています。

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

これは私がiPadで見るものです

これは私がiPadで見るものです このように表示する必要があります(iPhoneの同じサンプルコード)

私はそれをこのように表示する必要があります(iPhoneの同じサンプルコード):

4

1 に答える 1

2

Appleにバグレポートを提出しました。私のレポート(http://www.openradar.me/radar?id=2785401)は、バグID#12567789の重複としてクローズされました。したがって、これは既知の問題であるようです。

于 2013-03-08T16:32:37.137 に答える