UIApplication.Notifications.ObserveWillChangeStatusBarFrame Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Sobrecargas
ObserveWillChangeStatusBarFrame(EventHandler<UIStatusBarFrameChangeEventArgs>) |
Notificação fortemente tipada para a WillChangeStatusBarFrameNotification constante. |
ObserveWillChangeStatusBarFrame(NSObject, EventHandler<UIStatusBarFrameChangeEventArgs>) |
Notificação fortemente tipada para a WillChangeStatusBarFrameNotification constante. |
ObserveWillChangeStatusBarFrame(EventHandler<UIStatusBarFrameChangeEventArgs>)
Notificação fortemente tipada para a WillChangeStatusBarFrameNotification constante.
public static Foundation.NSObject ObserveWillChangeStatusBarFrame(EventHandler<UIKit.UIStatusBarFrameChangeEventArgs> handler);
static member ObserveWillChangeStatusBarFrame : EventHandler<UIKit.UIStatusBarFrameChangeEventArgs> -> Foundation.NSObject
Parâmetros
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 os desenvolvedores podem usar esse método em seu código:
//
// Lambda style
//
// listening
notification = UIApplication.Notifications.ObserveWillChangeStatusBarFrame ((sender, args) => {
/* Access strongly typed args */
Console.WriteLine ("Notification: {0}", args.Notification);
Console.WriteLine ("StatusBarFrame", args.StatusBarFrame);
});
// To stop listening:
notification.Dispose ();
//
//Method style
//
NSObject notification;
void Callback (object sender, UIKit.UIStatusBarFrameChangeEventArgs args)
{
// Access strongly typed args
Console.WriteLine ("Notification: {0}", args.Notification);
Console.WriteLine ("StatusBarFrame", args.StatusBarFrame);
}
void Setup ()
{
notification = UIApplication.Notifications.ObserveWillChangeStatusBarFrame (Callback);
}
void Teardown ()
{
notification.Dispose ();
}
Aplica-se a
ObserveWillChangeStatusBarFrame(NSObject, EventHandler<UIStatusBarFrameChangeEventArgs>)
Notificação fortemente tipada para a WillChangeStatusBarFrameNotification constante.
public static Foundation.NSObject ObserveWillChangeStatusBarFrame(Foundation.NSObject objectToObserve, EventHandler<UIKit.UIStatusBarFrameChangeEventArgs> handler);
static member ObserveWillChangeStatusBarFrame : Foundation.NSObject * EventHandler<UIKit.UIStatusBarFrameChangeEventArgs> -> Foundation.NSObject
Parâmetros
- objectToObserve
- NSObject
O objeto a ser observado.
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 WillChangeStatusBarFrameNotification notificações.
// Listen to all notifications posted for any object
var token = UIApplication.Notifications.ObserveWillChangeStatusBarFrame ((notification) => {
Console.WriteLine ("Observed WillChangeStatusBarFrameNotification!");
};
// Listen to all notifications posted for a single object
var token = UIApplication.Notifications.ObserveWillChangeStatusBarFrame (objectToObserve, (notification) => {
Console.WriteLine ($"Observed WillChangeStatusBarFrameNotification for {nameof (objectToObserve)}!");
};
// Stop listening for notifications
token.Dispose ();