Share via


UIApplication.Notifications.ObserveDidChangeStatusBarOrientation Method

Definition

Overloads

ObserveDidChangeStatusBarOrientation(EventHandler<UIStatusBarOrientationChangeEventArgs>)

Strongly typed notification for the DidChangeStatusBarOrientationNotification constant.

public static Foundation.NSObject ObserveDidChangeStatusBarOrientation(EventHandler<UIKit.UIStatusBarOrientationChangeEventArgs> handler);
static member ObserveDidChangeStatusBarOrientation : 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 DidChangeStatusBarOrientationNotification notifications.

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

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

Applies to

ObserveDidChangeStatusBarOrientation(NSObject, EventHandler<UIStatusBarOrientationChangeEventArgs>)

Strongly typed notification for the DidChangeStatusBarOrientationNotification constant.

public static Foundation.NSObject ObserveDidChangeStatusBarOrientation(Foundation.NSObject objectToObserve, EventHandler<UIKit.UIStatusBarOrientationChangeEventArgs> handler);
static member ObserveDidChangeStatusBarOrientation : 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 DidChangeStatusBarOrientationNotification notifications.

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

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

Applies to