4 iphone objective-c rotation mpmovieplayercontroller ios7
之前曾问过一个问题.我面临着同样的问题,即电影播放器没有旋转,因为项目属性不允许旋转.这个问题只是在iPhone7上面对iPhone,所以我正在尝试另外的工作,我在项目属性中启用所有方向,但问题是,当我通过这样的功能禁用其他视图控制器中的旋转
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return FALSE;
}
// Tell the system what we support
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationPortrait;
}
- (BOOL) shouldAutorotate {
return NO;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationPortrait;
}
Run Code Online (Sandbox Code Playgroud)
视图控制器仍然旋转,我认为这是因为它允许在项目属性中.
所以问题是......
当项目设置允许所有旋转时,如何禁用特定媒体播放器视图控制器中的旋转?
要么
如何在项目属性(禁用旋转)上覆盖特定Media Player视图控制器中的旋转,这在iOS7中不起作用
小智 8
你可以在AppDelegate类中实现以下方法,它对我有用:
- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
if ([[window.rootViewController presentedViewController] isKindOfClass:[MPMoviePlayerViewController class]])
{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
else
{
return UIInterfaceOrientationMaskPortrait;
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2553 次 |
| 最近记录: |