Condividi tramite


UIApplication.Notifications.ObserveContentSizeCategoryChanged Metodo

Definizione

Overload

ObserveContentSizeCategoryChanged(EventHandler<UIContentSizeCategoryChangedEventArgs>)

Notifica fortemente tipizzata per la ContentSizeCategoryChangedNotification costante.

ObserveContentSizeCategoryChanged(NSObject, EventHandler<UIContentSizeCategoryChangedEventArgs>)

Notifica fortemente tipizzata per la ContentSizeCategoryChangedNotification costante.

ObserveContentSizeCategoryChanged(EventHandler<UIContentSizeCategoryChangedEventArgs>)

Notifica fortemente tipizzata per la ContentSizeCategoryChangedNotification costante.

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

Parametri

handler
EventHandler<UIContentSizeCategoryChangedEventArgs>

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.ObserveContentSizeCategoryChanged ((sender, args) => {
    /* Access strongly typed args */
    Console.WriteLine ("Notification: {0}", args.Notification);

    Console.WriteLine ("WeakNewValue", args.WeakNewValue);
});

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

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

    Console.WriteLine ("WeakNewValue", args.WeakNewValue);
}

void Setup ()
{
    notification = UIApplication.Notifications.ObserveContentSizeCategoryChanged (Callback);
}

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

Si applica a

ObserveContentSizeCategoryChanged(NSObject, EventHandler<UIContentSizeCategoryChangedEventArgs>)

Notifica fortemente tipizzata per la ContentSizeCategoryChangedNotification costante.

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

Parametri

objectToObserve
NSObject

Oggetto da osservare.

handler
EventHandler<UIContentSizeCategoryChangedEventArgs>

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

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

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

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

Si applica a