gpt4 book ai didi

iOS 6 MPMoviePlayerViewController 和 presentMoviePlayerViewControllerAnimated 旋转

转载 作者:可可西里 更新时间:2023-11-01 05:01:17 25 4
gpt4 key购买 nike

在以前的 iOS 版本中,我们的视频会自动旋转,但在 iOS 6 中不再如此。我知道 presentMoviePlayerViewControllerAnimated 之前设计用于执行此操作,但我如何告诉 MPMoviePlayerViewController 自动旋转?

MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
[self presentMoviePlayerViewControllerAnimated:moviePlayer];

最佳答案

在 appdelegate.m 中:

- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
if ([[self.window.subviews.lastObject class].description isEqualToString:@"MPMovieView"]) {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
else {
return UIInterfaceOrientationMaskPortrait;
}
}

有点 hack,但效果很好......

关于iOS 6 MPMoviePlayerViewController 和 presentMoviePlayerViewControllerAnimated 旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12593542/

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