gpt4 book ai didi

ios - 将按钮或 UIView 放在视频顶部

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:09:07 26 4
gpt4 key购买 nike

是否可以在视频之上使用 uibutton/uiview?基本上,我想要一个屏幕(UIVIew),上面有按钮。因此,视频将按原样播放,用户可以使用按钮/uiview 执行操作

我的视频文件是mov格式

最佳答案

试试这个...

 - (void)playVideoInLoopMode:(BOOL)loop 
{
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"myvideo" ofType:@"m4v"]];

MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:url];
mp.controlStyle = MPMovieControlStyleNone;

if (loop)
{
mp.repeatMode = MPMovieRepeatModeOne;
}

mp.view.frame = CGRectMake(0.0, 0.0, self.view.bounds.size.width, self.view.bounds.size.height);
self.player = mp;
[self.view addSubview:self.player.view];
image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"myimage.png"]];
image.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
[self.player addSubview:image];
[self.player prepareToPlay];
[self.player play];
}

关于ios - 将按钮或 UIView 放在视频顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20392558/

26 4 0