次の方法で共有


UIWindow.Notifications.ObserveDidBecomeHidden メソッド

定義

オーバーロード

ObserveDidBecomeHidden(EventHandler<NSNotificationEventArgs>)

定数の厳密に型指定された通知 DidBecomeHiddenNotification

ObserveDidBecomeHidden(NSObject, EventHandler<NSNotificationEventArgs>)

定数の厳密に型指定された通知 DidBecomeHiddenNotification

ObserveDidBecomeHidden(EventHandler<NSNotificationEventArgs>)

定数の厳密に型指定された通知 DidBecomeHiddenNotification

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

パラメーター

handler
EventHandler<NSNotificationEventArgs>

通知が投稿されたときに呼び出すメソッド。

戻り値

通知を破棄するか、 に渡すことによって通知の受信を停止するために使用できる Token オブジェクト RemoveObservers(IEnumerable<NSObject>)

注釈

次の例は、コードでこのメソッドを使用する方法を示しています

//
// Lambda style
//

// listening
notification = UIWindow.Notifications.ObserveDidBecomeHidden ((sender, args) => {
    /* Access strongly typed args */
    Console.WriteLine ("Notification: {0}", args.Notification);
});

// To stop listening:
notification.Dispose ();

//
//Method style
//
NSObject notification;
void Callback (object sender, Foundation.NSNotificationEventArgs args)
{
    // Access strongly typed args
    Console.WriteLine ("Notification: {0}", args.Notification);
}

void Setup ()
{
    notification = UIWindow.Notifications.ObserveDidBecomeHidden (Callback);
}

void Teardown ()
{
    notification.Dispose ();
}

適用対象

ObserveDidBecomeHidden(NSObject, EventHandler<NSNotificationEventArgs>)

定数の厳密に型指定された通知 DidBecomeHiddenNotification

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

パラメーター

objectToObserve
NSObject

観察するオブジェクト。

handler
EventHandler<NSNotificationEventArgs>

通知が投稿されたときに呼び出すメソッド。

戻り値

通知を破棄するか、 に渡すことによって通知の受信を停止するために使用できる Token オブジェクト RemoveObservers(IEnumerable<NSObject>)

注釈

このメソッドは、通知を DidBecomeHiddenNotification サブスクライブするために使用できます。

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

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

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

適用対象