【问题标题】:MPMoviePlayerViewController notificationsMPMoviePlayerViewController 通知
【发布时间】:2011-09-12 09:28:23
【问题描述】:

如何给 MPMoviePlayerViewController 设置通知?和 MPMoviePlayerController 中的一样吗?

请显示示例

【问题讨论】:

    标签: objective-c ios mpmovieplayercontroller nsnotificationcenter


    【解决方案1】:

    MPMoviePlayerView控制器只是一个包装器,为您提供对 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 中相同的通知

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-01-03
      • 2014-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多