UIKeyboard.Notifications.ObserveWillShow 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
ObserveWillShow(EventHandler<UIKeyboardEventArgs>) |
Notifica fortemente tipizzata per la WillShowNotification costante. |
ObserveWillShow(NSObject, EventHandler<UIKeyboardEventArgs>) |
Notifica fortemente tipizzata per la WillShowNotification costante. |
ObserveWillShow(EventHandler<UIKeyboardEventArgs>)
Notifica fortemente tipizzata per la WillShowNotification costante.
public static Foundation.NSObject ObserveWillShow (EventHandler<UIKit.UIKeyboardEventArgs> handler);
static member ObserveWillShow : 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.ObserveWillShow ((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.ObserveWillShow (Callback);
}
void Teardown ()
{
notification.Dispose ();
}
Si applica a
ObserveWillShow(NSObject, EventHandler<UIKeyboardEventArgs>)
Notifica fortemente tipizzata per la WillShowNotification costante.
public static Foundation.NSObject ObserveWillShow (Foundation.NSObject objectToObserve, EventHandler<UIKit.UIKeyboardEventArgs> handler);
static member ObserveWillShow : 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 WillShowNotification le notifiche.
// Listen to all notifications posted for any object
var token = UIKeyboard.Notifications.ObserveWillShow ((notification) => {
Console.WriteLine ("Observed WillShowNotification!");
};
// Listen to all notifications posted for a single object
var token = UIKeyboard.Notifications.ObserveWillShow (objectToObserve, (notification) => {
Console.WriteLine ($"Observed WillShowNotification for {nameof (objectToObserve)}!");
};
// Stop listening for notifications
token.Dispose ();