Share via


MPMoviePlayerController.MoviePlayerReadyForDisplayDidChangeNotification Proprietà

Definizione

Costante di notifica per 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

Valore della proprietà

La costante NSString deve essere usata come token per NSNotificationCenter.

Attributi

Commenti

Questa costante può essere usata con per NSNotificationCenter registrare un listener per questa notifica. Si tratta di un NSString anziché di una stringa, perché questi valori possono essere usati come token in alcune librerie native anziché essere usati esclusivamente per il contenuto stringa effettivo. Il parametro 'notification' del callback contiene informazioni aggiuntive specifiche per il tipo di notifica.

Se si vuole sottoscrivere questa notifica, è possibile usare la praticità MPMoviePlayerController.Notifications. Metodo M:MPMoviePlayerController.Notifications.ObserveMoviePlayerReadyForDisplayDidChange* che offre accesso fortemente tipizzato ai parametri della notifica.

Nell'esempio seguente viene illustrato come usare la classe Notifiche fortemente tipizzata, per eseguire i tentativi di indovinare le proprietà disponibili nella notifica:

//
// 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 ();
}

Nell'esempio seguente viene illustrato come usare la notifica con 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);
}

Si applica a