Condividi tramite


UIApplication.Notifications.ObserveDidChangeStatusBarFrame Metodo

Definizione

Overload

ObserveDidChangeStatusBarFrame(EventHandler<UIStatusBarFrameChangeEventArgs>)

Notifica fortemente tipizzata per la DidChangeStatusBarFrameNotification costante.

ObserveDidChangeStatusBarFrame(NSObject, EventHandler<UIStatusBarFrameChangeEventArgs>)

Notifica fortemente tipizzata per la DidChangeStatusBarFrameNotification costante.

ObserveDidChangeStatusBarFrame(EventHandler<UIStatusBarFrameChangeEventArgs>)

Notifica fortemente tipizzata per la DidChangeStatusBarFrameNotification costante.

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

Parametri

handler
EventHandler<UIStatusBarFrameChangeEventArgs>

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 gli sviluppatori possono usare questo metodo nel codice:

//
// Lambda style
//

// listening
notification = UIApplication.Notifications.ObserveDidChangeStatusBarFrame ((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.ObserveDidChangeStatusBarFrame (Callback);
}

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

Si applica a

ObserveDidChangeStatusBarFrame(NSObject, EventHandler<UIStatusBarFrameChangeEventArgs>)

Notifica fortemente tipizzata per la DidChangeStatusBarFrameNotification costante.

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

Parametri

objectToObserve
NSObject

Oggetto da osservare.

handler
EventHandler<UIStatusBarFrameChangeEventArgs>

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

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

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

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

Si applica a