Condividi tramite


UIKeyboard.Notifications.ObserveWillHide Metodo

Definizione

Overload

ObserveWillHide(EventHandler<UIKeyboardEventArgs>)

Notifica fortemente tipizzata per la WillHideNotification costante.

ObserveWillHide(NSObject, EventHandler<UIKeyboardEventArgs>)

Notifica fortemente tipizzata per la WillHideNotification costante.

ObserveWillHide(EventHandler<UIKeyboardEventArgs>)

Notifica fortemente tipizzata per la WillHideNotification costante.

public static Foundation.NSObject ObserveWillHide (EventHandler<UIKit.UIKeyboardEventArgs> handler);
static member ObserveWillHide : EventHandler<UIKit.UIKeyboardEventArgs> -> Foundation.NSObject

Parametri

handler
EventHandler<UIKeyboardEventArgs>

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

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

//
// Lambda style
//

// listening
notification = UIKeyboard.Notifications.ObserveWillHide ((sender, args) => {
    /* Access strongly typed args */
    Console.WriteLine ("Notification: {0}", args.Notification);

    Console.WriteLine ("FrameBegin", args.FrameBegin);
    Console.WriteLine ("FrameEnd", args.FrameEnd);
    Console.WriteLine ("AnimationDuration", args.AnimationDuration);
    Console.WriteLine ("AnimationCurve", args.AnimationCurve);
});

// To stop listening:
notification.Dispose ();

//
//Method style
//
NSObject notification;
void Callback (object sender, UIKit.UIKeyboardEventArgs args)
{
    // Access strongly typed args
    Console.WriteLine ("Notification: {0}", args.Notification);

    Console.WriteLine ("FrameBegin", args.FrameBegin);
    Console.WriteLine ("FrameEnd", args.FrameEnd);
    Console.WriteLine ("AnimationDuration", args.AnimationDuration);
    Console.WriteLine ("AnimationCurve", args.AnimationCurve);
}

void Setup ()
{
    notification = UIKeyboard.Notifications.ObserveWillHide (Callback);
}

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

Si applica a

ObserveWillHide(NSObject, EventHandler<UIKeyboardEventArgs>)

Notifica fortemente tipizzata per la WillHideNotification costante.

public static Foundation.NSObject ObserveWillHide (Foundation.NSObject objectToObserve, EventHandler<UIKit.UIKeyboardEventArgs> handler);
static member ObserveWillHide : Foundation.NSObject * EventHandler<UIKit.UIKeyboardEventArgs> -> Foundation.NSObject

Parametri

objectToObserve
NSObject

Oggetto da osservare.

handler
EventHandler<UIKeyboardEventArgs>

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 WillHideNotification le notifiche.

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

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

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

Si applica a