gpt4 book ai didi

iphone - 当项目设置允许所有旋转时,在特定 View Controller 中禁用旋转

转载 作者:太空狗 更新时间:2023-10-30 04:00:07 25 4
gpt4 key购买 nike

问题是 asked earlier .我遇到了同样的问题,电影播放器​​没有旋转,因为项目属性不允许旋转。这个问题只在 iPhone 上的 iOS7 中遇到过,所以我正在尝试另一种解决方法,我在项目属性中启用所有方向,但问题是,每当我通过这样的函数禁用其他 View Controller 中的旋转时

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return FALSE;
}

// Tell the system what we support
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationPortrait;
}

- (BOOL) shouldAutorotate {
return NO;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationPortrait;

}

View Controller 仍在旋转,我想这是因为它在项目属性中允许。

所以问题是..

How can i disable Rotation in a specific Media Player View Controller when Project settings allows all rotation?

OR

How can i Override rotation in a specific Media Player view controller over project properties (Disabling rotation) which doesn't work in iOS7

最佳答案

您可以在 AppDelegate 类中实现以下方法,它对我有用:

 - (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {

if ([[window.rootViewController presentedViewController] isKindOfClass:[MPMoviePlayerViewController class]])
{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
else
{
return UIInterfaceOrientationMaskPortrait;
}
}

关于iphone - 当项目设置允许所有旋转时,在特定 View Controller 中禁用旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21134271/

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