我有一个关于方向和播放视频的疑问,
我的应用程序支持纵向模式,但是当我启动任何视频时,它只会运行横向模式,然后在视频完成后自动进入纵向模式。
在我正在使用的代码下方
**MyMovieViewController.h**
#import <MediaPlayer/MediaPlayer.h>
@interface MyMovieViewController : MPMoviePlayerViewController
@end
**MyMovieViewController.m**
@implementation MyMovieViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (BOOL)shouldAutorotate
{
return NO;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationLandscapeRight;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
@end
但以上代码仅适用于 iPhone 4.3 模拟器和我的应用程序支持 4.3 到 6.1。
所以请你帮帮我。