Share via


UIApplication.Notifications.ObserveWillChangeStatusBarOrientation Method

Definition

Overloads

ObserveWillChangeStatusBarOrientation(EventHandler<UIStatusBarOrientationChangeEventArgs>)

Strongly typed notification for the WillChangeStatusBarOrientationNotification constant.

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

Parameters

handler
EventHandler<UIStatusBarOrientationChangeEventArgs>

The handler that responds to the notification when it occurs.

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 to WillChangeStatusBarOrientationNotification notifications.

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

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

Applies to

ObserveWillChangeStatusBarOrientation(NSObject, EventHandler<UIStatusBarOrientationChangeEventArgs>)

Strongly typed notification for the WillChangeStatusBarOrientationNotification constant.

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

Parameters

objectToObserve
NSObject

The specific object to observe.

handler
EventHandler<UIStatusBarOrientationChangeEventArgs>

The handler that responds to the notification when it occurs.

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 to WillChangeStatusBarOrientationNotification notifications.

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

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

Applies to