비디오 버튼은 내비게이션 막대의 ViewController에 있으며 눌렀을 때 비디오가 세로 모드로 즉시 표시됩니다. 수동으로 회전하는 경우에만 가로 방향으로 표시됩니다. 버튼을 누른 후 즉시 비디오를 가로 모드로 표시하려면 어떻게합니까? ViewController를 세로 모드로, 가로 모드로만 비디오가 있어야합니다.가로로 비디오를 자동으로 회전하는 방법은 무엇입니까?
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
-(IBAction)backbutton
{
ChapterTableViewController *chapterTable = [self.storyboard instantiateViewControllerWithIdentifier:@"chapterTable"];
[self.navigationController presentModalViewController:chapterTable animated:YES];
}
-(IBAction)playvideo
{
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"One Piece Episode 180" ofType:@"mp4"]];
MPMoviePlayerViewController *playercontroller = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
[self presentMoviePlayerViewControllerAnimated:playercontroller];
playercontroller.moviePlayer.movieSourceType = MPMovieSourceTypeFile;
[playercontroller.moviePlayer play];
playercontroller = nil;
}
@end
나는 방법을 사용하여 시도했지만 작동하지 않습니다. – icee
편집 된 답변 –
가로 모드가되지만 비디오는 세로 모드입니다. – icee