ios - TabBarController 的界面方向

标签 ios xcode uiwebview uiinterfaceorientation

我在我的应用程序中使用了标签栏 Controller 。在应用程序的大部分行为中,我们只有一个方向 (interfaceOrientationPortrait)。但我有一个在 WebView 中运行视频的 View 。当我播放这段视频时,方向仍然是纵向。我想把所有的方向。

好吧,我在我的视频类中使用了返回类型 YES。什么也没有变。我在 RootViewController 类中将返回类型更改为 YES。什么也没有变。

我只想更改视频的方向。

最佳答案

如果任何选项卡栏 Controller 不能旋转到某个方向(至少在选项卡栏可见时),作为选项卡栏 Controller 一部分的 View Controller 将不会旋转到该方向。因此,如果 Web View Controller 在选项卡栏 Controller 上可见,您可能想要更新所有 Controller 的方法,以便让旋转发生。

如果您需要更深入的解释,请询问。祝你好运!

编辑(示例代码)

这可能是您的标签栏 Controller View Controller 的旋转方法:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if ((self.tabBarController.selectedIndex == kMyWebViewControllerIndex))
    {
        return YES;
    } else
    {
        return (orientation == UIInterfaceOrientationPortrait);
    }
}

关于ios - TabBarController 的界面方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12167071/

相关文章:

仅 iOS 纵向应用程序从横向的 UIWebview youtube 返回

ios - HTML 不尊重 UIWebView 中的 .CSS 文件

ios - 在 NSString stringWithFormat 上崩溃

ios - 为什么 "[self class] == [super class]"?

php - JSON -> Xcode 字符串格式

ios - 一个 Controller 中的两个 TableView

iOS Swift NSLayoutConstraint。无法设置水平居中 View

c# - 移动检测未按预期工作

objective-c - Cocoa 框架和 C 静态库有什么区别?

ios - 我无法在 Xcode 5 中创建 socket