UIKeyboard.Notifications.ObserveDidShow Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Overload
ObserveDidShow(EventHandler<UIKeyboardEventArgs>) |
Notifica fortemente tipizzata per la DidShowNotification costante. |
ObserveDidShow(NSObject, EventHandler<UIKeyboardEventArgs>) |
Notifica fortemente tipizzata per la DidShowNotification costante. |
ObserveDidShow(EventHandler<UIKeyboardEventArgs>)
Notifica fortemente tipizzata per la DidShowNotification costante.
public static Foundation.NSObject ObserveDidShow (EventHandler<UIKit.UIKeyboardEventArgs> handler);
static member ObserveDidShow : EventHandler<UIKit.UIKeyboardEventArgs> -> Foundation.NSObject
Parametri
- handler
- EventHandler<UIKeyboardEventArgs>
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 = UIKeyboard.Notifications.ObserveDidShow ((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.ObserveDidShow (Callback);
}
void Teardown ()
{
notification.Dispose ();
}
Si applica a
ObserveDidShow(NSObject, EventHandler<UIKeyboardEventArgs>)
Notifica fortemente tipizzata per la DidShowNotification costante.
public static Foundation.NSObject ObserveDidShow (Foundation.NSObject objectToObserve, EventHandler<UIKit.UIKeyboardEventArgs> handler);
static member ObserveDidShow : Foundation.NSObject * EventHandler<UIKit.UIKeyboardEventArgs> -> Foundation.NSObject
Parametri
- objectToObserve
- NSObject
Oggetto da osservare.
- handler
- EventHandler<UIKeyboardEventArgs>
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 DidShowNotification le notifiche.
// Listen to all notifications posted for any object
var token = UIKeyboard.Notifications.ObserveDidShow ((notification) => {
Console.WriteLine ("Observed DidShowNotification!");
};
// Listen to all notifications posted for a single object
var token = UIKeyboard.Notifications.ObserveDidShow (objectToObserve, (notification) => {
Console.WriteLine ($"Observed DidShowNotification for {nameof (objectToObserve)}!");
};
// Stop listening for notifications
token.Dispose ();