【问题标题】:Probable bug on iPad for UIDocumentInteractionController: presentPreviewAnimated is not pushed into the navigation stackiPad 上 UIDocumentInteractionController 的可能错误:presentPreviewAnimated 未推入导航堆栈
【发布时间】:2012-10-24 21:19:13
【问题描述】:

仅限 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 上看到的

我需要这样显示(iPhone 上的示例代码相同)

【问题讨论】:

标签: controller document modalviewcontroller interaction ios6


【解决方案1】:

我向 Apple 提交了错误报告。我的报告 (http://www.openradar.me/radar?id=2785401) 因错误 ID# 12567789 的重复而被关闭。所以显然这是一个已知问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-31
    • 2011-06-26
    • 1970-01-01
    • 2017-02-12
    • 1970-01-01
    • 1970-01-01
    • 2011-03-20
    • 1970-01-01
    相关资源
    最近更新 更多