Compartilhar via


UIView.Notifications.ObserveSwitchControlStatusDidChange Método

Definição

Sobrecargas

ObserveSwitchControlStatusDidChange(EventHandler<NSNotificationEventArgs>)

Notificação fortemente tipada para a SwitchControlStatusDidChangeNotification constante.

ObserveSwitchControlStatusDidChange(NSObject, EventHandler<NSNotificationEventArgs>)

Notificação fortemente tipada para a SwitchControlStatusDidChangeNotification constante.

ObserveSwitchControlStatusDidChange(EventHandler<NSNotificationEventArgs>)

Notificação fortemente tipada para a SwitchControlStatusDidChangeNotification constante.

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

Parâmetros

handler
EventHandler<NSNotificationEventArgs>

Método a ser invocado quando a notificação é postada.

Retornos

Objeto de token que pode ser usado para parar de receber notificações descartando-o ou passando-o para RemoveObservers(IEnumerable<NSObject>)

Comentários

Esse método pode ser usado para assinar SwitchControlStatusDidChangeNotification notificações.

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

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

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

Aplica-se a

ObserveSwitchControlStatusDidChange(NSObject, EventHandler<NSNotificationEventArgs>)

Notificação fortemente tipada para a SwitchControlStatusDidChangeNotification constante.

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

Parâmetros

objectToObserve
NSObject

O objeto a ser observado.

handler
EventHandler<NSNotificationEventArgs>

Método a ser invocado quando a notificação é postada.

Retornos

Objeto de token que pode ser usado para parar de receber notificações descartando-o ou passando-o para RemoveObservers(IEnumerable<NSObject>)

Comentários

Esse método pode ser usado para assinar SwitchControlStatusDidChangeNotification notificações.

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

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

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

Aplica-se a