另一个视图下的MPMoviePlayerController视图

时间:2013-05-16 18:57:24

标签: ios uiview uiimageview mpmovieplayercontroller

如果我这样做:

self.productVideo = [[MPMoviePlayerController alloc] initWithContentURL:movieClip];
self.productVideo.controlStyle = MPMovieControlStyleNone;
self.productVideo.shouldAutoplay = YES;
[self.productVideo prepareToPlay];
self.productVideo.repeatMode = MPMovieRepeatModeOne;
self.productVideo.view.frame = self.productImage.frame;
self.productVideo.view.userInteractionEnabled = NO;

[self.view insertSubview:productVideo.view belowSubview:self.productImage];

当我将图像清晰地添加到图像下方时,电影会出现在图像的顶部。是否无法在电影上方叠加图像?

1 个答案:

答案 0 :(得分:2)

您可以尝试将图像视图添加到mp.view,然后添加mp.view。如下所示:

self.productVideo = [[MPMoviePlayerController alloc] initWithContentURL:movieClip];
self.productVideo.controlStyle = MPMovieControlStyleNone;
self.productVideo.shouldAutoplay = YES;
[self.productVideo prepareToPlay];
self.productVideo.repeatMode = MPMovieRepeatModeOne;
self.productVideo.view.frame = self.productImage.frame;
self.productVideo.view.userInteractionEnabled = NO;
[;self.productVide.view addSubView:self.productImage]

[self.view addSubview:productVideo.view];

这是你想要完成的吗?

如果您打算在视频开始时隐藏图像或类似的东西,您可能无法使用image.hidden = YES和image.hidden = NO。然后你将不得不求助于改变图像的alpha值,我听说这对某些人有效。