- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
因此我们构建了一个仅支持横向的 iPad 应用程序。这是通过在 plist 中将 Supported interface orientations (iPad)
设置为 Landscape (left/right home button)
来强制执行的。此外,所有 UIViewControllers
都实现了 shouldAutorotateToInterfaceOrientation:
,如下所示:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
这工作正常,应用程序被锁定在横向。现在我们在其中一个 View 中嵌入了一个 MPMoviePlayerController
。当用户全屏观看这部电影时,他可以旋转到纵向。电影播放器似乎绕过了我们所有的景观设置。这对我来说很好,但是当用户点击 done
按钮时仍然是纵向的,我们所有的 UIViewControllers
也是纵向的,看起来很糟糕!
用户必须将 iPad 旋转到横屏状态才能再次看起来不错,然后将无法按预期旋转回竖屏。
那么,即使所有 shouldAutorotateToInterfaceOrientation
告诉 iOS 不要旋转为纵向,为什么我的 View 仍旋转为纵向?我如何确保电影播放器不会旋转我的 View ?
如果您的解决方案还将电影播放器本身锁定在横向模式中,那对我来说没问题。只要我的观点不旋转,我就很高兴! :)
最佳答案
So why are my views rotated to portrait even when all shouldAutorotateToInterfaceOrientation tell iOS to not rotate to portrait? And how can I make sure the movieplayer does not rotate my views?
If your solution also locks the movieplayer itself in landscape, that's fine with me. As long as my views aren't rotated it's fine with me! :)
我在使用这个 View 层次结构时遇到了这个确切的问题:
+------------------------+ +-------------------+
| | | |
| UINavigationController +->| Some Intermediate |
| | | View Controllers |
+------------------------+ | |
+---------------+---+
|
v
+--------------------------+
| MPMoviePlayerController |
| (embed) |
+--------------------------+
所有中间 View Controller 都被锁定为横向,因此应用程序永远不会处于纵向,除非 MPMoviePlayerController 处于全屏状态(导致与 OP 完全相同的问题)。
解决方案是通过创建覆盖 shouldAutorotateToInterfaceOrientation
的子类将 UINavigationController 锁定为横向。这样 MPMoviePlayerController 就不再旋转到纵向。我怀疑在进入全屏时它会将自己添加到主窗口的 rootViewController 中,在我的例子中是 UINavigationController(或者更确切地说是我的子类)。
希望这对您有所帮助!
关于ios - MPMoviePlayerController 在全屏模式后使 App 的方向不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10091290/
我有这个 MPMovePlayerController 和一个自定义 slider (它不是一个 slider ,但它具有相同的目的)。考虑到我的“ slider ”可以返回我需要的任何浮点值,我怎样
我正在使用 m3u8 视频格式来流式传输视频,现在我需要显示相同的字幕。 我在 Apple 文档中搜索,发现我可以通过使用 closedCaptionDisplayEnabled 来实现这一点。 AV
我正在使用 MPMoviePlayerController 在我的应用程序中播放一个视频。下面是我播放视频的代码。 **NSURL *url=[[NSURL alloc] initFileUR
请检查以下代码: (void) moviePlayerDidExitFullscreen:(NSNotification*)notification { MPMoviePlayerControlle
为了在我的应用中播放视频,我设置了 MPMoviePlayerController并将其添加到 subview 。用户可以使用捏合手势更改为全屏模式。 在此 viewController (包含电影播
有没有捕捉异常的方法(特别是对于网络错误 /没有可用连接)当使用 MPMoviePlayerController 时? 我特别担心一旦播放器的实例被初始化为 initWithURL:您无法知道电影加载
这真让我抓狂。 很简单,我有一个 MPMoviePlayerViewController 并且想要全屏显示电影。 在 iOS 5.0+ 上使用 ARC 我想让这个播放器应用程序范围内可重用。 这部电影
MPMoviePlayerController 似乎存在问题,一旦您处于全屏模式并按住快进按钮,让它向前搜索(以快速播放)一直到视频结尾。 此后,你只会得到一个黑屏,它被卡住了。换句话说,它不响应任何
我正在使用 MPMoviePlayerController 在 iPad 上播放电影。 当用户将设备旋转到横向时,我将其设置为全屏。 如果用户随后点击“退出全屏”或“完成”,电影将动画回到其小帧( n
我正在将应用程序移植到 iOS 8。我有一些代码可以播放以前可以运行的视频,但现在不能了。 当我运行它时,我收到以下错误: ( "", "", "", "", "", "", "", "", "" )
MPMoviePlayerController 支持哪些格式? 最佳答案 根据the documentation : 支持的格式 此类播放 iOS 支持的任何电影或音频文件。这包括流式内容和固定长度文
已结束。此问题正在寻求书籍、工具、软件库等的推荐。它不满足Stack Overflow guidelines 。目前不接受答案。 我们不允许提出寻求书籍、工具、软件库等推荐的问题。您可以编辑问题,以便
这是代码 - (void)applicationDidFinishLaunching:(UIApplication *)application { NSBundle *bundle = [NSBu
每次我的应用程序更改显示的动画(这是一部循环电影)时,他都会暂停,直到最终开始播放电影。MoviePlayerConntroller 是这样创建的 self.moviePlayer = [MP
MPMoviePlayerController 几乎按照我想要的方式工作,除了它覆盖了屏幕上的任何其他项目,例如我的导航栏。有没有办法阻止这种情况发生? 最佳答案 它的播放器是基于 UIView 的,
我们可以像MPMoviePlayerController中的默认Slider一样制作自定义控件吗用于前进和后退电影? 最佳答案 虽然您无法修改 MPMoviePlayerController 类,但您
我想自定义 MPMoviePlayerController 来为视频播放器添加更多控制。我可以添加额外的控件,但顶部缓冲控件被删除。我怎样才能让它可见? 最佳答案 我对你的问题的理解是你想在 MPMo
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:video_url]
如何调整 MPMoviePlayerController 的帧大小? 最佳答案 通过新版本的 MPMoviePlayerController,您可以做到。 关于iphone - MPMoviePlay
我需要在没有播放器任何覆盖的情况下播放电影。没有播放/停止按钮,没有时间线,没有开始/结束时间,没有进度条,什么都没有。只是 subview 中的普通裸体电影。然后这部电影可能会被我自己的图形覆盖。该
我是一名优秀的程序员,十分优秀!