iOS:MPMoviePlayerController 完成按钮不起作用
我将 MPMoviePlayerController 添加到视图中,如下所示:
player = [[MPMoviePlayerController alloc] initWithContentURL:url];
player.controlStyle = MPMovieControlStyleNone;
[player.view setFrame:self.playerView.bounds];
[self.playerView addSubview:player.view];
self.playerView 是我的主视图内的一个小视图,并且我有自定义按钮来控制同一主视图中的播放。这一切都很好。
我有一个全屏按钮,其工作方式如下:
- (IBAction) btnFullScreenPressed:(id)sender {
[player setFullscreen:TRUE animated:TRUE];
[player setControlStyle:MPMovieControlStyleFullscreen];
}
这工作正常,但是当我点击全屏控件上的“完成”按钮时,电影停止播放,但不会返回到我视图中较小的 self.playerView 。我怎样才能让它“非全屏”并返回到较小的 self.playerView?
谢谢。
I am adding an MPMoviePlayerController to a view like so:
player = [[MPMoviePlayerController alloc] initWithContentURL:url];
player.controlStyle = MPMovieControlStyleNone;
[player.view setFrame:self.playerView.bounds];
[self.playerView addSubview:player.view];
self.playerView is a small view inside my main view and I have custom buttons that control playback within that same main view. This all works fine.
I have a fullscreen button that works like so:
- (IBAction) btnFullScreenPressed:(id)sender {
[player setFullscreen:TRUE animated:TRUE];
[player setControlStyle:MPMovieControlStyleFullscreen];
}
This works fine, but then when I hit the Done button on the full screen controls, the movie stops playing but does not return to the smaller self.playerView in my view. How can I get it to "un-fullscreen" and return to the smaller self.playerView?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
相当不直观的是,您实际上必须将控件样式设置为默认值,即:
当然,然后当您收到 MPMoviePlayerWillExitFullscreenNotification 或 MPMoviePlayerDidExitFullscreenNotification (我更喜欢“did exit”)时,将其设置回无。
Quite unintuitively you actually have to set the control style to default, i.e.:
and, of course, then set it back to none when you receive MPMoviePlayerWillExitFullscreenNotification or MPMoviePlayerDidExitFullscreenNotification (I prefer "did exit").