如何设置MPMoviePlayerViewController的通知?它与MPMoviePlayerController中的相同吗?
请显示示例
答案 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