Compartir a través de


UIViewController.Notifications.ObserveShowDetailTargetDidChange Método

Definición

Sobrecargas

ObserveShowDetailTargetDidChange(EventHandler<NSNotificationEventArgs>)

Notificación fuertemente tipada para la ShowDetailTargetDidChangeNotification constante.

ObserveShowDetailTargetDidChange(NSObject, EventHandler<NSNotificationEventArgs>)

Notificación fuertemente tipada para la ShowDetailTargetDidChangeNotification constante.

ObserveShowDetailTargetDidChange(EventHandler<NSNotificationEventArgs>)

Notificación fuertemente tipada para la ShowDetailTargetDidChangeNotification constante.

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

Parámetros

handler
EventHandler<NSNotificationEventArgs>

Método para invocar cuando se publica la notificación.

Devoluciones

Objeto de token que se puede usar para dejar de recibir notificaciones al eliminarlo o pasarlo a RemoveObservers(IEnumerable<NSObject>)

Comentarios

En el ejemplo siguiente se muestra cómo puede usar este método en el código.

//
// Lambda style
//

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

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

Se aplica a

ObserveShowDetailTargetDidChange(NSObject, EventHandler<NSNotificationEventArgs>)

Notificación fuertemente tipada para la ShowDetailTargetDidChangeNotification constante.

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

Parámetros

objectToObserve
NSObject

Objeto que se va a observar.

handler
EventHandler<NSNotificationEventArgs>

Método para invocar cuando se publica la notificación.

Devoluciones

Objeto de token que se puede usar para dejar de recibir notificaciones al eliminarlo o pasarlo a RemoveObservers(IEnumerable<NSObject>)

Comentarios

Este método se puede usar para suscribirse ShowDetailTargetDidChangeNotification a las notificaciones.

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

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

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

Se aplica a