gpt4 book ai didi

ios - 标签栏应用程序中的方向

转载 作者:行者123 更新时间:2023-12-03 06:25:24 26 4
gpt4 key购买 nike

我创建了一个标签栏应用程序,除了在应用程序的一个 View Controller 中使用Web View在Web应用程序中全屏播放youtube视频时,我一直希望以纵向显示。

我怎样才能做到这一点??

最佳答案

在项目设置中,选择“纵向”,“向左横向”和“向右横向”设备方向。

在TabBarController类中,重写supportedInterfaceOrientation方法。请参阅下面的代码。将此代码复制并粘贴到TabBarController中

-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait;
}

这样可以确保选项卡栏 View 始终保持纵向。

在具有Web View 的ViewController中,实现以下版本的supportedInterFaceOrientation方法。
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft;
}

这确保了具有Web View 的ViewController可以更改为横向。

注意:呈现具有Web View 的ViewController模态。它不应该是TabBarController中的选项卡。

关于ios - 标签栏应用程序中的方向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27511373/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com