Tim*_*aev 2 objective-c mpmovieplayercontroller nsnotificationcenter ios
如何设置MPMoviePlayerViewController的通知?它与MPMoviePlayerController中的相同吗?
请显示示例
Fai*_* S. 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
Run Code Online (Sandbox Code Playgroud)
您可以并且应该使用的通知中包含更多通知 MPMoviePlayerController Class Reference
所以基本上,是的 - 您可以使用与中相同的通知 MPMoviePlayerController