完成电影播放器上的完成后恢复为肖像? [英] Reverting to portrait after Done pressed on movie player?
问题描述
我有一个MPMoviePlayer工作。它旨在将邮资大小的电影显示为视图中的子视图。当手机旋转为横向时,它将进入全屏模式。当手机处于人像状态时,它会进入邮票图像模式。
I've got a MPMoviePlayer working. It is designed to show a postage-stamp size movie as a subview in the view. When the phone is rotated into landscape, it goes into full screen mode. And when the phone is in portrait it goes into postage-stamp portrait mode.
唯一的问题是当我在横向模式下按完成时,它会保持在横向状态,邮票大小的电影,而不是回到肖像..
The only problem is when I press Done when in landscape mode, it stays in landscape, with the postage stamp sized movie, rather than kick back into portrait..
这是我的一些代码:
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight || toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
[moviePlayerController setFullscreen:YES animated:YES];
} else
{
[moviePlayerController setFullscreen:NO animated:YES];
}
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeLeft;
}
按下后如何让它进入肖像模式完成?
How would I get it to kick into portrait mode after pressing Done?
推荐答案
@cannyboy ...如果您的应用程序仅适用于您的APPDelegate.m,则需要使用以下方法肖像模式
@cannyboy...you just need to use below method in your APPDelegate.m if your application only works with portrait mode
- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
if ([[window.rootViewController presentedViewController] isKindOfClass:[MPMoviePlayerViewController class]])
{
//NSLog(@"in if part");
return UIInterfaceOrientationMaskAllButUpsideDown;
}
else
{
//NSLog(@"in else part");
return UIInterfaceOrientationMaskPortrait;
}}
这篇关于完成电影播放器上的完成后恢复为肖像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!