图片是从 Path App 截取的,你可以看到,在表格视图中,有一个视频剪辑,当我点击播放按钮时,视频播放而不会变成全屏。
似乎视频嵌入在表格视图中?
这该怎么做?你能举个例子吗?谢谢
取自我的一个项目,只需调整它以满足您的需求:
NSURL *movieUrl = [NSURL fileURLWithPath:moviePath];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:movieUrl];
player.view.frame = CGRectMake(0, 0, 690, 370);
// Here is where you set the control Style like fullscreen or embedded
player.controlStyle = MPMovieControlStyleDefault;
//player.controlStyle = MPMovieControlStyleEmbedded;
//player.controlStyle = MPMovieControlStyleDefault;
//player.controlStyle = MPMovieControlStyleFullscreen;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinished) name:MPMoviePlayerPlaybackDidFinishNotification object:player];
UIView *movieBox = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 600, 400)];
[movieBox setBackgroundColor:[UIColor blackColor]];
[movieBox addSubview:player.view];
[self.view addSubview:movieBox];
player.scalingMode = MPMovieScalingModeAspectFit;
player.contentURL = movieUrl;
[player play];