2011-09-28 53 views
1

終於我必須在這裏發佈我的問題。是的,這裏可能是重複的問題,因爲我提到了很多關於這個問題的答案。但是我找不到任何修復。 (也沒有發現任何關於特定的標籤欄應用程序的問題...)而且我不想使用MPMoviePlayerViewControllerMPMoviePlayerController:方向問題

我有標籤欄應用程序。在上一個標籤的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

thanx的回覆...我試過你的解決方案,但它墜毀...我只是想改變球員的方向...我認爲默認是風景,但在我的情況下它的肖像我認爲由於標籤欄應用程序。我無法理解該怎麼做...... – Maulik

回答