目标C:如何更改MPMoviePlayerController的toolBar的背景颜色

时间:2014-07-01 15:26:46

标签: ios objective-c mpmovieplayercontroller

在我的应用程序中,我必须在MPMoviePlayerController上播放视频。 为此,我把代码写成了吼叫。

- (void)playVideo
{
    //[imagePikerView removeFromSuperview];
    moviePlayerController = [[MPMoviePlayerController alloc] init];
    NSURL *url = [NSURL fileURLWithPath: self.VideoPath];
    [moviePlayerController setContentURL: url];

    int x = 50;
    int y = 50;
    int width =  CGRectGetHeight(self.view.frame)- 2*x;
      int height =  CGRectGetWidth(self.view.frame)- 50; //height = width in landscape mode
    [moviePlayerController.view setFrame: CGRectMake(x, y, width, height)];


    moviePlayerController.backgroundView.backgroundColor = [UIColor clearColor];

    //NSLog(@"[moviePlayerController.view subviews] === %@",);

    for (UIView *viw in [moviePlayerController.view subviews]) {
        NSLog(@"[moviePlayerController.view subviews] === %@",[viw subviews]); ;
    }


    [self.view addSubview:moviePlayerController.view];
    [moviePlayerController play];


}

我想将黑色透明工具栏颜色更改为redColor(用箭头显示)

enter image description here

1 个答案:

答案 0 :(得分:0)

如果你想改变你可以使用的整个背景颜色

moviePlayer.backgroundColor = [UIColor redColor];

否则,首先将其重置为null

this.NavigationController.NavigationBar.TintColor = null;
this.NavigationController.NavigationBar.BarTintColor = null;

然后应用颜色,例如

tabBarController.Appearance.barTintColor = UIColor.Red;
tabBarController.Appearance.TintColor = UIColor.Red;