UIMenuController.Notifications.ObserveMenuFrameDidChange Method

Definition

Overloads

ObserveMenuFrameDidChange(EventHandler<NSNotificationEventArgs>)

Strongly typed notification for the MenuFrameDidChangeNotification constant.

ObserveMenuFrameDidChange(NSObject, EventHandler<NSNotificationEventArgs>)

Strongly typed notification for the MenuFrameDidChangeNotification constant.

ObserveMenuFrameDidChange(EventHandler<NSNotificationEventArgs>)

Strongly typed notification for the MenuFrameDidChangeNotification constant.

public static Foundation.NSObject ObserveMenuFrameDidChange (EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveMenuFrameDidChange : 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 MenuFrameDidChangeNotification notifications.

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

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

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

Applies to

ObserveMenuFrameDidChange(NSObject, EventHandler<NSNotificationEventArgs>)

Strongly typed notification for the MenuFrameDidChangeNotification constant.

public static Foundation.NSObject ObserveMenuFrameDidChange (Foundation.NSObject objectToObserve, EventHandler<Foundation.NSNotificationEventArgs> handler);
static member ObserveMenuFrameDidChange : Foundation.NSObject * EventHandler<Foundation.NSNotificationEventArgs> -> Foundation.NSObject

Parameters

objectToObserve
NSObject

The object to observe.

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 MenuFrameDidChangeNotification notifications.

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

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

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

Applies to