播放风景视频后出现纵向显示问题

时间:2015-02-05 17:34:55

标签: xcode ios8 orientation

我有一个向用户显示文件的iPhone应用程序(视频,pdf文件和文档)。当我在FileViewController中单击文件缩略图时,我调用UIDocumentInteractionController将文件呈现给用户。除文档控制器外,所有应用程序屏幕均锁定为纵向,可以旋转以查看横向。这在以前的版本中都运行良好,但它突然发生了变化和破坏,我猜想iOS 8何时发布。

现在,如果我播放视频并将其旋转为横向并点击完成,视频将从屏幕上移除,并且调用文档的FileViewController笔尖将在屏幕的一半处切断视图。

我已完成一些测试并打印出视图边界的宽度和高度。在iPhone 4S上进行测试,当我第一次加载FileViewController时,宽度和高度是320 x 480,正确。

当我以横向模式播放视频并点击完成时,底层视图会自动旋转回纵向,因为在此视图中横向不支持,但是当打印出屏幕边界时,宽度为480,高度为320它仍然认为该应用程序是在景观中,即使它已被移回肖像。屏幕本身是正确的方式,只是在320像素后切断!

我一直试图操纵各种控件的方向,但我无法看到甚至产生问题的原因,更不用说修复它了。

这就是我通过方向实现的方式:

该应用程序已设置为支持所有方向。

我有标签栏控制器的子类来指定以下内容:

- (BOOL)shouldAutorotate
{
    return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationPortrait;
}

在FileViewController中,我调用以下代码:

- (void) Show_File:(File *)file 
{
    NSURL *targetURL = [NSURL fileURLWithPath:filePath];

    UIDocumentInteractionController *document = [UIDocumentInteractionController interactionControllerWithURL: targetURL];
    document.delegate = self;

    [document presentPreviewAnimated: YES];
}

- (UIViewController *)documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller
{
    AppDelegate *theDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];

    return theDelegate.fileNavController.childViewControllerForStatusBarHidden;
}

有什么想法吗?我一直在搜索,但我找不到有这个问题的人。感谢。

1 个答案:

答案 0 :(得分:2)

对于遇到此问题的其他人,我向Apple提出了一张支持票,显然这是一个iOS错误....

“这是一个错误QLPreviewController(由UIDocumentInteractionController用于显示预览)”

我现在的工作正常。在我的UITabBarController的子类中,我已经完成了这段代码:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

     if (self.transitionCoordinator && self.presentedViewController.presentationController {
        self.view.frame = self.presentedViewController.presentationController.containerView.bounds;
     }
}
相关问题