gpt4 book ai didi

ios - 肖像应用程序。风景视频。 shouldAutoRotate 未运行

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:10:57 27 4
gpt4 key购买 nike

我有一个非常烦人的问题,我已经为此奋斗了几个小时。我有一个只能纵向运行的应用程序,但当我播放视频时,我希望它能横向播放。

据我所知,解决这个问题的方法是更改​​ Info.plist 以允许横向、横向和纵向,然后遍历所有 viewControllers 并放入以下代码

- (BOOL)shouldAutorotate {
return NO;
}

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

//ios4 and ios5
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

问题是似乎根本没有调用它,因为在运行应用程序时仍然允许自由旋转。

谁能想到可能导致此问题的原因?

我不知道是否值得一提,但我正在运行最新的 xcode 5 测试版并在我的 iPhone 5 上运行 ios 7。

非常感谢。卢克

最佳答案

我遇到了类似的问题。就我而言,除了 1 个 UINavigationController 之外,我希望我的所有应用程序都是纵向的。我是这样解决的:

我有一个以 UItabBarController 为根的应用程序。我的 5 个选项卡中的每一个都嵌入在 UINavigationController 中……这似乎是问题所在。所以,我所做的是

1- 您必须在“部署信息”中允许所有“设备方向”

2- 我为我的 UITabBarController 创建了一个自定义类。

3- 在 .m 中,我添加了以下代码:

- (BOOL)shouldAutorotate {
return YES;}

- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait; }

4- 然后,在 UIViewController 中,我想有所不同,我在 .m 中添加了以下代码:

- (BOOL)shouldAutorotate {
return YES; }

- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll; }

瞧瞧!

希望这对您有所帮助。

康拉德

关于ios - 肖像应用程序。风景视频。 shouldAutoRotate 未运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18861347/

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