如果我这样做:
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];
当我清楚地将它添加到图像下方时,电影出现在图像上方。不能在电影之上叠加图像吗?
最佳答案
您可以尝试将 ImageView 添加到 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 值,我听说这对某些人来说效果很好。
关于ios - 另一个 View 下的 MPMoviePlayerController View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16595303/