dan*_*zlo 22 iphone objective-c ios
我有一些奇怪的行为,当我改变时我MPMoviePlayerViewController不会auto旋转orientation.但是,我在一个新项目中重新创建了相同的视图层次结构,当MPMoviePlayerViewController播放器启动时,它会旋转到每个方向.我已经仔细研究了该项目,寻找可能明确设定方向的任何东西,但没有任何东西.
我将在此列出所有相关信息以及迄今为止我尝试过的事情.
视图层次结构当前如下所示:
视图层次结构中的每个类都响应于shouldAutorotateToInterfaceOrientation,仅对UIInterfaceOrientationPortrait为YES.
我试过的事情:
shouldAutorotateToInterfaceOrientation"根"VC 的向上堆栈发送到MPMoviePlayerViewControllerMPMoviePlayerViewController子类实施shouldAutorotateToInterfaceOrientation返回YES针对横向取向和是为所有的方向.presentMoviePlayerViewControllerAnimated从Feed VC中调用其他VC如果电影播放器在具有相同视图层次结构的新项目中正确旋转,那么可能会遇到什么问题.关于方向可能会被卡住的任何想法?
小智 7
我建议你不要使用presentMoviePlayerViewControllerAnimated,而不是添加为子视图.我认为它会很好地解决你的问题.
MPMoviePlayerViewController *mpviewController = [[MPMoviePlayerViewController alloc]
initWithContentURL:[NSURL fileURLWithPath:self.filePath]];
[self.view addSubview:mpviewController.view];
[self setWantsFullScreenLayout:YES];
Run Code Online (Sandbox Code Playgroud)
并mpviewController.view在MPMoviePlayerPlaybackDidFinishNotification检测到时删除.让我看看你的成功......
解决方案:
对于可能遇到此问题的任何人,视频不旋转的原因是我不小心添加了具有窗口 rootViewController 的 RootViewController,而不是 UINavigationController。
self.window.rootViewController = navController;
Run Code Online (Sandbox Code Playgroud)
是正确的
self.window.rootViewController = rootViewController;
不是
感谢大家一路以来的帮助和投入。
| 归档时间: |
|
| 查看次数: |
8020 次 |
| 最近记录: |