UIApplication.Notifications.ObserveWillChangeStatusBarOrientation メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
オーバーロード
ObserveWillChangeStatusBarOrientation(EventHandler<UIStatusBarOrientationChangeEventArgs>)
定数に対して WillChangeStatusBarOrientationNotification 厳密に型指定された通知。
public static Foundation.NSObject ObserveWillChangeStatusBarOrientation(EventHandler<UIKit.UIStatusBarOrientationChangeEventArgs> handler);
static member ObserveWillChangeStatusBarOrientation : EventHandler<UIKit.UIStatusBarOrientationChangeEventArgs> -> Foundation.NSObject
パラメーター
通知が投稿されたときに呼び出すメソッド。
戻り値
通知を破棄するか、またはに渡すことによって通知の受信を停止するために使用できるトークン オブジェクト RemoveObservers(IEnumerable<NSObject>)
注釈
次の例は、開発者がコードでこのメソッドを使用する方法を示しています。
//
// Lambda style
//
// listening
notification = UIApplication.Notifications.ObserveWillChangeStatusBarOrientation ((sender, args) => {
/* Access strongly typed args */
Console.WriteLine ("Notification: {0}", args.Notification);
Console.WriteLine ("StatusBarOrientation", args.StatusBarOrientation);
});
// To stop listening:
notification.Dispose ();
//
//Method style
//
NSObject notification;
void Callback (object sender, UIKit.UIStatusBarOrientationChangeEventArgs args)
{
// Access strongly typed args
Console.WriteLine ("Notification: {0}", args.Notification);
Console.WriteLine ("StatusBarOrientation", args.StatusBarOrientation);
}
void Setup ()
{
notification = UIApplication.Notifications.ObserveWillChangeStatusBarOrientation (Callback);
}
void Teardown ()
{
notification.Dispose ();
}
適用対象
ObserveWillChangeStatusBarOrientation(NSObject, EventHandler<UIStatusBarOrientationChangeEventArgs>)
定数に対して WillChangeStatusBarOrientationNotification 厳密に型指定された通知。
public static Foundation.NSObject ObserveWillChangeStatusBarOrientation(Foundation.NSObject objectToObserve, EventHandler<UIKit.UIStatusBarOrientationChangeEventArgs> handler);
static member ObserveWillChangeStatusBarOrientation : Foundation.NSObject * EventHandler<UIKit.UIStatusBarOrientationChangeEventArgs> -> Foundation.NSObject
パラメーター
- objectToObserve
- NSObject
観察するオブジェクト。
通知が投稿されたときに呼び出すメソッド。
戻り値
通知を破棄するか、またはに渡すことによって通知の受信を停止するために使用できるトークン オブジェクト RemoveObservers(IEnumerable<NSObject>)
注釈
このメソッドは、通知を WillChangeStatusBarOrientationNotification サブスクライブするために使用できます。
// Listen to all notifications posted for any object
var token = UIApplication.Notifications.ObserveWillChangeStatusBarOrientation ((notification) => {
Console.WriteLine ("Observed WillChangeStatusBarOrientationNotification!");
};
// 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 ();