Share via


NSExtensionContext.HostDidEnterBackgroundNotification Proprietà

Definizione

Costante di notifica per HostDidEnterBackground

[Foundation.Advice("Use NSExtensionContext.Notifications.ObserveHostDidEnterBackground helper method instead.")]
[Foundation.Field("NSExtensionHostDidEnterBackgroundNotification", "Foundation")]
[ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 8, 2, ObjCRuntime.PlatformArchitecture.All, null)]
public static Foundation.NSString HostDidEnterBackgroundNotification { [ObjCRuntime.Introduced(ObjCRuntime.PlatformName.iOS, 8, 2, ObjCRuntime.PlatformArchitecture.All, null)] get; }
member this.HostDidEnterBackgroundNotification : 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.

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


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

void Setup ()
{
    NSNotificationCenter.DefaultCenter.AddObserver (NSExtensionContext.HostDidEnterBackgroundNotification, Callback);
}

Si applica a