Edit

Share via


CTFontManager.Notifications.ObserveRegisteredFontsChanged Method

Definition

Strongly typed notification for the P:CoreText.CTFontManager.RegisteredFontsChangedNotification constant.

public static Foundation.NSObject ObserveRegisteredFontsChanged (EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveRegisteredFontsChanged : EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject

Parameters

handler
EventHandler<NSNotificationEventArgs>

Method to invoke when the notification is posted.

Returns

Token object that can be used to stop receiving notifications by either disposing it or passing it to RemoveObservers(IEnumerable<NSObject>)

Remarks

This method can be used to subscribe for P:CoreText.CTFontManager.RegisteredFontsChangedNotification notifications.

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

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

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

Applies to