Вращение MPMoviePlayerController

Как повернуть видеопроигрыватель в iOS-программировании с помощью MPMoviePlayerController.

Мой код:

moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL]; 
[self.view addSubview:moviePlayerController.view];
 moviePlayerController.fullscreen = YES;
[moviePlayerController play];
2 ответа

Попробуйте изменить границы и поверните представление следующим образом:

[[moviePlayer view] setBounds:CGRectMake(20, 0, 480, 350)];
[[moviePlayer view] setTransform:CGAffineTransformMakeRotation(M_PI / 2)];
playerControlsContainer.hidden = YES;


попробуй это

-(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]; 
}}

licensed under cc by-sa 3.0 with attribution.