2011-09-29 59 views
1

我想從MPMediaPlayer中刪除或禁用查找轉發按鈕。 我試圖列舉所有的意見,但顯然我找不到這個按鈕。iPhone-MPMediaPlayer禁用查找轉發按鈕

有沒有人有任何想法?

謝謝。

+0

提供了一些代碼或更多的信息你實際上在做什麼... – DShah

+0

我提出了一個MPMediaPlayerViewController來播放電影。必須防止用戶快進電影。但是落後和播放/暫停功能必須工作。 –

回答

-1

我發現的唯一方法是在查找前進按鈕上添加一個透明按鈕。 這裏是代碼:

- (void)viewDidAppear:(BOOL)animated 
{ 
[super viewDidAppear:animated]; 

    UIButton *button = [[UIButton alloc] init]; 

    if(UIInterfaceOrientationIsLandscape(self.interfaceOrientation)) 
     [button setFrame:CGRectMake(535, 599, 90, 60)]; 
    else 
     [button setFrame:CGRectMake(407, 855, 90, 60)]; 

    [button setBackgroundColor:[UIColor clearColor]]; 
    [button setAlpha:0.7]; 
    [button setTag:1200]; 

    [self.moviePlayer.view addSubview:button]; 
    [button release]; 
} 


- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 
{ 
    if(UIInterfaceOrientationIsLandscape(toInterfaceOrientation)) 
    { 
     UIButton *button = (UIButton *)[self.moviePlayer.view viewWithTag:1200]; 
     [button setFrame:CGRectMake(535, 599, 90, 60)]; 
    } 
    else 
    { 
     UIButton *button = (UIButton *)[self.moviePlayer.view viewWithTag:1200]; 
     [button setFrame:CGRectMake(407, 855, 90, 60)]; 
    } 
} 

這是隻適用於IPAD!如果您想在iPhone上做同樣的事情,請更改透明按鈕的位置。

+0

而當Apple更新控制器的位置時,那又怎樣? –

+0

然後,如果你不喜歡這個答案,請找到另一種方式來做到這一點。 :P ...哦,並且是Apple接受的一種方式。謝謝 –

0

你總是可以提供一個自定義的控制面板,你可以隱藏默認控件與

playerController.controlStyle = MPMovieControlStyleNone; 

然後添加包含您的接口子視圖,只是鏈接按鈕播放/暫停開始/停止倒帶,並且有一個變速滑塊的開源實現(OBSlider)。您還需要註冊一些MP通知:

MPMovieDurationAvailableNotification 
MPMoviePlayerLoadStateDidChangeNotification 
MPMoviePlayerPlaybackDidFinishNotification 
MPMoviePlayerPlaybackStateDidChangeNotification 
+0

我只需要禁用seek forward按鈕。 –