Freigeben über


MPMoviePlayerController.SourceTypeAvailableNotification Eigenschaft

Definition

Benachrichtigungskonstante für SourceTypeAvailable

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

Eigenschaftswert

Die NSString-Konstante sollte als Token für NSNotificationCenter verwendet werden.

Attribute

Hinweise

Diese Konstante kann mit dem NSNotificationCenter verwendet werden, um einen Listener für diese Benachrichtigung zu registrieren. Dies ist ein NSString anstelle einer Zeichenfolge, da diese Werte in einigen nativen Bibliotheken als Token verwendet werden können, anstatt nur für ihren tatsächlichen Zeichenfolgeninhalt verwendet zu werden. Der Parameter "notification" für den Rückruf enthält zusätzliche Informationen, die für den Benachrichtigungstyp spezifisch sind.

Wenn Sie diese Benachrichtigung abonnieren möchten, können Sie die benutzerfreundliche MPMoviePlayerController.Notificationsoption verwenden. M:MPMoviePlayerController.Notifications.ObserveSourceTypeAvailable*-Methode, die stark typisierten Zugriff auf die Parameter der Benachrichtigung bietet.

Das folgende Beispiel zeigt, wie Sie die stark typisierte Notifications-Klasse verwenden, um die verfügbaren Eigenschaften in der Benachrichtigung zu entmutigen:

//
// Lambda style
//

// listening
notification = MPMoviePlayerController.Notifications.ObserveSourceTypeAvailable ((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.ObserveSourceTypeAvailable (Callback);
}

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

Das folgende Beispiel zeigt, wie Sie die Benachrichtigung mit der DefaultCenter-API verwenden:

// Lambda style
NSNotificationCenter.DefaultCenter.AddObserver (
        MPMoviePlayerController.SourceTypeAvailableNotification, (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.SourceTypeAvailableNotification, Callback);
}

Gilt für: