iPad上UIDocumentInteractionController的可能错误:presentPreviewAnimated没有被推入导航堆栈

时间:2012-10-24 21:19:14

标签: controller document modalviewcontroller interaction ios6

仅限iPad:UIDocumentInteractionController presentPreviewAnimated未被推入导航堆栈,即使从documentInteractionControllerViewControllerForPreview

返回导航控制器时也只显示模态

大家好

我想知道是否有人可以在这里帮助我,我相信这可能是一个与iPad相关的错误(它可以在iPhone上运行),但在我提交之前需要确认。

为了让UIDocumentInteractionController在导航控制器中工作,我按照推荐的方法返回导航控制器表单documentInteractionControllerViewControllerForPreview,但它不起作用。

我甚至尝试将Apple提供的UIDocumentInteractionController代码示例升级到iPad,果然,即使我从documentInteractionControllerViewControllerForPreview返回导航控制器,文档交互控制器也会以模态显示。但是对于iPhone来说,它确实会被推入导航堆栈。

我试图设计一个基于splitviewcontroller的应用程序,该应用程序使用doc交互控制器读取PDF文件,这样PDF将显示在DetailViewController中,但这仅适用于QLPreviewController(不是Doc交互控制器)。

有没有人有此问题?我把下面的示例代码放在我看到的图像中:

我正在使用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];
}

这是我在iPad上看到的

This is what I see on the iPad 我需要像这样展示它(iPhone上的相同示例代码)

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

1 个答案:

答案 0 :(得分:2)

我向Apple提交了一份错误报告。我的报告(http://www.openradar.me/radar?id=2785401)已作为错误ID#12567789的副本关闭。显然这是一个已知问题。