MPMoviePlayerController 与 MPMoviePlayerViewController
我是 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
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.
Zaius,
用最简单的术语来说,
MPMoviePlayerViewController
使用MPMoviePlayerController
显示电影/视频。因此,
MPMoviePlayerController
是您可以访问的MPMoviePlayerViewController
中的一个属性。MPMoviePlayerViewController.moviePlayer
是您用来访问MPMoviePlayerController
属性的属性。希望任何点击此线程的人都会发现这很有用!
例子:
Zaius,
In the simplest terms,
MPMoviePlayerViewController
displays the movie/video using theMPMoviePlayerController
.hence,
MPMoviePlayerController
is a property inMPMoviePlayerViewController
that you can access.MPMoviePlayerViewController.moviePlayer
is the property that you'd use to accessMPMoviePlayerController
properties.Hope anyone hitting this thread will find this useful!
Example: