0

如果我这样做:

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];

当我清楚地将它添加到图像下方时,电影出现在图像顶部。不能在电影上叠加图像吗?

4

1 回答 1

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 值,我听说这对某些人来说效果很好。

于 2013-05-16T19:05:49.013 回答