iOS:MPMoviePlayerController 完成按钮不起作用

标签 ios mpmovieplayercontroller fullscreen

我正在将 MPMoviePlayerController 添加到 View 中,如下所示:

player = [[MPMoviePlayerController alloc] initWithContentURL:url];
player.controlStyle = MPMovieControlStyleNone; 
[player.view setFrame:self.playerView.bounds];     
[self.playerView addSubview:player.view];

self.playerView 是我主视图中的一个小 View ,我有自定义按钮来控制同一个主视图中的播放。这一切都很好。

我有一个像这样工作的全屏按钮:

- (IBAction) btnFullScreenPressed:(id)sender {
    [player setFullscreen:TRUE animated:TRUE];
    [player setControlStyle:MPMovieControlStyleFullscreen];
}

这工作正常,但是当我点击全屏控件上的完成按钮时,电影停止播放但没有返回到我 View 中较小的 self.playerView。我怎样才能让它“取消全屏”并返回到较小的 self.playerView?

谢谢。

最佳答案

很不直观,你实际上必须将控件样式设置为默认,即:

- (IBAction) btnFullScreenPressed:(id)sender {
    [player setFullscreen:TRUE animated:TRUE];
    [player setControlStyle:MPMovieControlStyleDefault];
}

当然,当您收到 MPMoviePlayerWillExitFullscreenNotification 或 MPMoviePlayerDidExitFullscreenNotification(我更喜欢“退出”)时,将其设置回无。

关于iOS:MPMoviePlayerController 完成按钮不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6356696/

相关文章:

ios - 使用 URLSeason 连接 github

ios - 在sqlite中更改日期格式

ios - Swift 3 按钮从 tableView 单元格中消失

ios - MPMoviePlayerController View 未调整大小

android - 非全屏 Activity

java - 如何检测以全屏模式运行的非 Java 程序?

ios - iOS 上的 React-NativescrollToEnd 的行为与手动滚动不同,将项目置于底部

ios - 出现此异常 - "property storage cannot find expected per-thread storage data"

objective-c - 如何使用 MPMoviePlayerController 播放视频

cocoa - NSOpenGLView 从 View 内切换到全屏