2011-09-28 5 views
1

마침내 여기에 내 문제를 게시해야합니다. 네,이 질문에 관해서 많은 답변을 언급 했으므로 여기에 중복 질문이있을 수 있습니다. 그러나 나는 어떤 고침도 찾을 수 없습니다. (또한 탭 모음 응용 프로그램과 관련하여 어떤 질문도 찾지 못했습니다 ...) 그리고 MPMoviePlayerViewController를 사용하고 싶지 않습니다.MPMoviePlayerController : orientation problem

나는 탭바 응용 프로그램이 있습니다. 마지막 탭의 VC에는 버튼이 있습니다. 클릭 이벤트에서 무비 플레이어를 시작하고 싶습니다. 그 때문에 나는 MPMoviePlayerController을 사용하고 있습니다. 오리엔테이션이 인 경우 모두 괜찮습니다. 세로입니다. 그러나 변화에 관해서는, 지금 나는 조경 모드에서만 그것을해야한다.

-(void)playMovie 
{ 
    [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight]; 
    [self.scrollView addSubview:moviePlayer.view]; 

    [moviePlayer play]; 
    [moviePlayer setFullscreen:TRUE]; 
} 
-(void)btnPlayHandler:(id)sender 
{ 
    NSLog(@"btnPlayHandler"); 

    NSURL * videoUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@",[dictResponse valueForKey:@"VideoPath"]]]; 
    moviePlayer = [[MPMoviePlayerController alloc]initWithContentURL:videoUrl]; 
    //[moviePlayer.view setFrame:CGRectMake(20, 40, 280, 222)]; 
    moviePlayer.fullscreen = YES ; 
    moviePlayer.shouldAutoplay = NO ; 

    [self performSelector:@selector(playMovie) withObject:nil afterDelay:1];  
} 

- (void) movieWillExit:(NSNotification *)notification 
{ 
    [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait]; 
} 

- (void) movieExit:(NSNotification *)notification 
{ 
    [moviePlayer stop]; 
    [moviePlayer.view removeFromSuperview]; 
    moviePlayer = nil ; 

    [btnPlay setHidden:FALSE]; 
} 

- (void)moviePreLoad:(NSNotification *)notification 
{ 
    NSLog(@"moviePreLoad"); 
} 

- (void)moviePlaybackComplete:(NSNotification *)notification 
{ 
    NSLog(@"moviePlaybackComplete"); 
    [btnPlay setHidden:FALSE]; 
} 

만 장치의 방향이 아닌 플레이어의보기를 변경 :

여기 내 코드입니다! 이걸 어떻게 수행 할까 ??? 그것은 탭 표시 줄 응용 프로그램 때문입니까?

+0

흠! 복잡한 문제. :) 나는 풀려고했지만 나는 할 수 없었다. 나는 그것에 대해 연구 할 것이지만 나중에. –

+0

답장을위한 고맙습니다 ... 나는 ur 솔루션을 시도했지만 추락했습니다 ... 저는 플레이어의 방향을 바꾸고 싶습니다 ... 저는 디폴트가 Landscape라고 생각하지만 제 경우에는 Tab-bar 어플리케이션으로 인해 생각합니다. 나는 무엇을해야하는지 이해할 수 없었다 ... – Maulik

답변