Compartilhar via


UIMenuController.Notifications.ObserveDidHideMenu Método

Definição

Sobrecargas

ObserveDidHideMenu(EventHandler<NSNotificationEventArgs>)

Notificação fortemente tipada para a DidHideMenuNotification constante.

ObserveDidHideMenu(NSObject, EventHandler<NSNotificationEventArgs>)

Notificação fortemente tipada para a DidHideMenuNotification constante.

ObserveDidHideMenu(EventHandler<NSNotificationEventArgs>)

Notificação fortemente tipada para a DidHideMenuNotification constante.

public static Foundation.NSObject ObserveDidHideMenu (EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveDidHideMenu : 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

O exemplo a seguir mostra como você pode usar esse método em seu código

//
// Lambda style
//

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

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

Aplica-se a

ObserveDidHideMenu(NSObject, EventHandler<NSNotificationEventArgs>)

Notificação fortemente tipada para a DidHideMenuNotification constante.

public static Foundation.NSObject ObserveDidHideMenu (Foundation.NSObject objectToObserve, EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveDidHideMenu : 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 DidHideMenuNotification notificações.

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

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

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

Aplica-se a