1

我想从 MPMediaPlayer 中删除或禁用搜索前进按钮。我试图枚举所有视图,但显然我找不到这个按钮。

有人有什么主意吗?

谢谢。

4

2 回答 2

0

你总是可以提供一个自定义控制面板,你可以隐藏默认控件

playerController.controlStyle = MPMovieControlStyleNone;

然后添加一个包含您的界面的子视图,并仅链接按钮以播放/暂停开始/停止倒带,并且有变速滑块(OBSlider)的开源实现。您还需要注册一些 MP 通知:

MPMovieDurationAvailableNotification
MPMoviePlayerLoadStateDidChangeNotification
MPMoviePlayerPlaybackDidFinishNotification
MPMoviePlayerPlaybackStateDidChangeNotification
于 2011-10-10T08:43:14.110 回答
-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 上做同样的事情,请更改透明按钮的位置。

于 2011-10-11T08:37:00.970 回答