UIMenuController.Notifications.ObserveDidHideMenu Metodo

Definizione

Overload

ObserveDidHideMenu(EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la DidHideMenuNotification costante.

ObserveDidHideMenu(NSObject, EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la DidHideMenuNotification costante.

ObserveDidHideMenu(EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la DidHideMenuNotification costante.

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

Parametri

handler
EventHandler<NSNotificationEventArgs>

Metodo da richiamare quando viene pubblicata la notifica.

Restituisce

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

Commenti

Nell'esempio seguente viene illustrato come usare questo metodo nel codice

//
// 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 ();
}

Si applica a

ObserveDidHideMenu(NSObject, EventHandler<NSNotificationEventArgs>)

Notifica fortemente tipizzata per la DidHideMenuNotification costante.

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

Parametri

objectToObserve
NSObject

Oggetto da osservare.

handler
EventHandler<NSNotificationEventArgs>

Metodo da richiamare quando viene pubblicata la notifica.

Restituisce

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

Commenti

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

// 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 ();

Si applica a