NSValueTransformer.Notifications.ObserveUserDefaultsDidChange Metodo

Definizione

Overload

ObserveUserDefaultsDidChange(EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la UserDefaultsDidChangeNotification costante.

ObserveUserDefaultsDidChange(NSObject, EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la UserDefaultsDidChangeNotification costante.

ObserveUserDefaultsDidChange(EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la UserDefaultsDidChangeNotification costante.

public static Foundation.NSObject ObserveUserDefaultsDidChange (EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveUserDefaultsDidChange : EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject

Parametri

handler
EventHandler<NSNotificationEventArgs>

Metodo da richiamare quando viene inviata la notifica.

Restituisce

Oggetto token che può essere usato per interrompere la ricezione delle notifiche eliminandolo o passandolo a RemoveObservers(IEnumerable<NSObject>)

Commenti

Questo metodo può essere usato per sottoscrivere UserDefaultsDidChangeNotification le notifiche.

// Listen to all notifications posted for any object
var token = NSValueTransformer.Notifications.ObserveUserDefaultsDidChange ((notification) => {
	Console.WriteLine ("Observed UserDefaultsDidChangeNotification!");
};

// Listen to all notifications posted for a single object
var token = NSValueTransformer.Notifications.ObserveUserDefaultsDidChange (objectToObserve, (notification) => {
	Console.WriteLine ($"Observed UserDefaultsDidChangeNotification for {nameof (objectToObserve)}!");
};

// Stop listening for notifications
token.Dispose ();

Si applica a

ObserveUserDefaultsDidChange(NSObject, EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la UserDefaultsDidChangeNotification costante.

public static Foundation.NSObject ObserveUserDefaultsDidChange (Foundation.NSObject objectToObserve, EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveUserDefaultsDidChange : Foundation.NSObject * EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject

Parametri

objectToObserve
NSObject

Oggetto da osservare.

handler
EventHandler<NSNotificationEventArgs>

Metodo da richiamare quando viene inviata la notifica.

Restituisce

Oggetto token che può essere usato per interrompere la ricezione delle notifiche eliminandolo o passandolo a RemoveObservers(IEnumerable<NSObject>)

Commenti

Questo metodo può essere usato per sottoscrivere UserDefaultsDidChangeNotification le notifiche.

// Listen to all notifications posted for any object
var token = NSValueTransformer.Notifications.ObserveUserDefaultsDidChange ((notification) => {
	Console.WriteLine ("Observed UserDefaultsDidChangeNotification!");
};

// Listen to all notifications posted for a single object
var token = NSValueTransformer.Notifications.ObserveUserDefaultsDidChange (objectToObserve, (notification) => {
	Console.WriteLine ($"Observed UserDefaultsDidChangeNotification for {nameof (objectToObserve)}!");
};

// Stop listening for notifications
token.Dispose ();

Si applica a