Partager via


MPMoviePlayerController.MoviePlayerReadyForDisplayDidChangeNotification Propriété

Définition

Constante de notification pour MoviePlayerReadyForDisplayDidChange

[Foundation.Advice("Use MPMoviePlayerController.Notifications.ObserveMoviePlayerReadyForDisplayDidChange helper method instead.")]
[Foundation.Field("MPMoviePlayerReadyForDisplayDidChangeNotification", "MediaPlayer")]
[ObjCRuntime.Deprecated(ObjCRuntime.PlatformName.iOS, 9, 0, ObjCRuntime.PlatformArchitecture.All, "Use 'AVPlayerViewController' (AVKit) instead.")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 6, 0, ObjCRuntime.PlatformArchitecture.All, null)]
[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)]
public static Foundation.NSString MoviePlayerReadyForDisplayDidChangeNotification { [ObjCRuntime.Deprecated(ObjCRuntime.PlatformName.iOS, 9, 0, ObjCRuntime.PlatformArchitecture.All, "Use 'AVPlayerViewController' (AVKit) instead.")] [ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 6, 0, ObjCRuntime.PlatformArchitecture.All, null)] [ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.WatchOS, ObjCRuntime.PlatformArchitecture.All, null)] get; }
member this.MoviePlayerReadyForDisplayDidChangeNotification : Foundation.NSString

Valeur de propriété

La constante NSString doit être utilisée comme jeton pour NSNotificationCenter.

Attributs

Remarques

Cette constante peut être utilisée avec pour NSNotificationCenter inscrire un écouteur pour cette notification. Il s’agit d’un NSString au lieu d’une chaîne, car ces valeurs peuvent être utilisées comme jetons dans certaines bibliothèques natives au lieu d’être utilisées uniquement pour leur contenu de chaîne réel. Le paramètre « notification » du rappel contient des informations supplémentaires spécifiques au type de notification.

Si vous souhaitez vous abonner à cette notification, vous pouvez utiliser la fonctionnalité .MPMoviePlayerController.Notifications Méthode M:MPMoviePlayerController.Notifications.ObserveMoviePlayerReadyForDisplayDidChange* qui offre un accès fortement typé aux paramètres de la notification.

L’exemple suivant montre comment utiliser la classe Notifications fortement typée pour extraire les suppositions des propriétés disponibles dans la notification :

//
// Lambda style
//

// listening
notification = MPMoviePlayerController.Notifications.ObserveMoviePlayerReadyForDisplayDidChange ((sender, args) => {
    /* Access strongly typed args */
    Console.WriteLine ("Notification: {0}", args.Notification);
});

// To stop listening:
notification.Dispose ();

//
// Method style
//
NSObject notification;
void Callback (object sender, Foundation.NSNotificationEventArgs args)
{
    // Access strongly typed args
    Console.WriteLine ("Notification: {0}", args.Notification);
}

void Setup ()
{
    notification = MPMoviePlayerController.Notifications.ObserveMoviePlayerReadyForDisplayDidChange (Callback);
}

void Teardown ()
{
    notification.Dispose ();
}

L’exemple suivant montre comment utiliser la notification avec l’API DefaultCenter :

// Lambda style
NSNotificationCenter.DefaultCenter.AddObserver (
        MPMoviePlayerController.MoviePlayerReadyForDisplayDidChangeNotification, (notification) => {Console.WriteLine ("Received the notification MPMoviePlayerController", notification); }


// Method style
void Callback (NSNotification notification)
{
    Console.WriteLine ("Received a notification MPMoviePlayerController", notification);
}

void Setup ()
{
    NSNotificationCenter.DefaultCenter.AddObserver (MPMoviePlayerController.MoviePlayerReadyForDisplayDidChangeNotification, Callback);
}

S’applique à