MPMoviePlayerViewController通知

时间:2011-09-12 09:28:23

标签: objective-c ios mpmovieplayercontroller nsnotificationcenter

如何设置MPMoviePlayerViewController的通知?它与MPMoviePlayerController中的相同吗?

请显示示例

1 个答案:

答案 0 :(得分:16)

MPMoviePlayer 查看控制器只是一个包装器,可以为MPMoviePlayerController提供控件。

MPMoviePlayerViewController有自己的MPMoviePlayerController,可以发送您使用它所需的所有通知。

收听通知如下:

// Register for the playback finished notification
[[NSNotificationCenter defaultCenter] addObserver:self // the object listening / "observing" to the notification
    selector:@selector(myMovieFinishedCallback:) // method to call when the notification was pushed
    name:MPMoviePlayerPlaybackDidFinishNotification // notification the observer should listen to
    object:self.moviePlayerViewController.moviePlayer]; // the object that is passed to the method

MPMoviePlayerController Class Reference

中列出了更多可以和应该使用的通知

基本上,是的 - 您可以使用与MPMoviePlayerController

中相同的通知