如何使用MPMoviePlayerController在iOS编程中旋转视频播放器。
我的代码:
moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
[self.view addSubview:moviePlayerController.view];
moviePlayerController.fullscreen = YES;
[moviePlayerController play];发布于 2013-12-26 18:46:45
尝试更改边界并旋转视图,如下所示:
[[moviePlayer view] setBounds:CGRectMake(20, 0, 480, 350)];
[[moviePlayer view] setTransform:CGAffineTransformMakeRotation(M_PI / 2)];
playerControlsContainer.hidden = YES;发布于 2013-12-26 18:40:33
尝尝这个
-(void)viewWillAppear:(BOOL)animated
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ChangedmyMPMoviePlayerController :) name:UIDeviceOrientationDidChangeNotification object:nil];
}
-(void) ChangedmyMPMoviePlayerController:(NSNotification *)notification
{
[self adjustMPMoviePlayerController:[[UIApplication sharedApplication] statusBarOrientation]];
}
- (void) adjustMPMoviePlayerControlle:(UIInterfaceOrientation) orientation {
if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown)
{
[self.moviePlayerController setFullscreen:NO animated:YES];
}
else if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight)
{
[self.moviePlayerController setFullscreen:YES animated:YES];
}}https://stackoverflow.com/questions/20783298
复制相似问题