MPMoviePlayerController 与 MPMoviePlayerViewController

发布于 2024-09-30 12:43:39 字数 190 浏览 0 评论 0原文

我是 iPhone 开发新手。只是想知道 MPMoviePlayerController 和 MPMoviePlayerViewController 之间有什么区别。另外,更一般地说,控制器和视图控制器之间有什么区别?我知道您使用控制器来构造视图(与 MPMoviePlayerController.view 一样),那么 ViewController 会创建什么?

I'm new to iPhone development. Just wondering what the difference is between the MPMoviePlayerController and the MPMoviePlayerViewController. Also, more generally, what is the difference between a controller and a view controller? I know that you use a controller to construct a view (as with MPMoviePlayerController.view), so what does a ViewController create?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧夏天 2024-10-07 12:43:39

MPMoviePlayerController 只是一个电影播放器​​,它为您提供了一种在 iPhone 上播放电影的方法,MPMoviePlayerViewController 是一个实际的视图控制器子类,负责 MPMoviePlayerController 的呈现...文档位于 苹果 把它放在
“MPMoviePlayerController 实例或电影播放器​​管理文件或网络流中电影的播放。播放可以在全屏模式下进行,也可以在电影播放器​​提供的自定义视图中进行。您可以将视图合并到您自己的视图层次结构或使用 MPMoviePlayerViewController 对象来为您管理演示文稿。”

viewControler 和控制器之间没有任何关系,此类恰好被命名为 MPMoviePlayerController,因为它使您可以控制电影播放器​​。实际上,在(我认为是4.0)之前,没有视图控制器,只有电影播放器​​,后来苹果决定也合并电影播放器​​视图控制器。

The MPMoviePlayerController is just a movie player, it provides a way for you to play movies on the iPhone, a MPMoviePlayerViewController is an actual view controller subclass that takes care of presentation of the MPMoviePlayerController...as documentation at apple puts it
"An MPMoviePlayerController instance, or movie player, manages the playback of a movie from a file or a network stream. Playback occurs either in full-screen mode or in a custom view that is vended by the movie player. You can incorporate the view into your own view hierarchies or use an MPMoviePlayerViewController object to manage the presentation for you."

There is no relation between a viewControler and a controller, this class just happens to be named MPMoviePlayerController because it gives you control over the movie player. Actually before (4.0 i think) there was no view controller and just the movie player, later apple decided to incorporate the movie player view controller too.

原谅我要高飞 2024-10-07 12:43:39

Zaius,

用最简单的术语来说,MPMoviePlayerViewController 使用 MPMoviePlayerController 显示电影/视频。

因此,MPMoviePlayerController 是您可以访问的 MPMoviePlayerViewController 中的一个属性。

MPMoviePlayerViewController.movi​​ePlayer 是您用来访问 MPMoviePlayerController 属性的属性。

希望任何点击此线程的人都会发现这很有用!

例子:

MyMoviePlayerViewController  * moviePlayerVC = [[MPMoviePlayerViewController alloc]initWithContentURL:movieURL];
moviePlayerVC.moviePlayer.allowsAirPlay = YES;

Zaius,

In the simplest terms, MPMoviePlayerViewController displays the movie/video using the MPMoviePlayerController.

hence, MPMoviePlayerController is a property in MPMoviePlayerViewController that you can access.

MPMoviePlayerViewController.moviePlayer is the property that you'd use to access MPMoviePlayerController properties.

Hope anyone hitting this thread will find this useful!

Example:

MyMoviePlayerViewController  * moviePlayerVC = [[MPMoviePlayerViewController alloc]initWithContentURL:movieURL];
moviePlayerVC.moviePlayer.allowsAirPlay = YES;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文