Share via


UIApplication.Notifications.ObserveWillChangeStatusBarOrientation 메서드

정의

오버로드

ObserveWillChangeStatusBarOrientation(EventHandler<UIStatusBarOrientationChangeEventArgs>)

상수에 대한 강력한 형식의 알림입니다 WillChangeStatusBarOrientationNotification .

ObserveWillChangeStatusBarOrientation(NSObject, EventHandler<UIStatusBarOrientationChangeEventArgs>)

상수에 대한 강력한 형식의 알림입니다 WillChangeStatusBarOrientationNotification .

ObserveWillChangeStatusBarOrientation(EventHandler<UIStatusBarOrientationChangeEventArgs>)

상수에 대한 강력한 형식의 알림입니다 WillChangeStatusBarOrientationNotification .

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

매개 변수

handler
EventHandler<UIStatusBarOrientationChangeEventArgs>

알림이 게시될 때 호출할 메서드입니다.

반환

토큰 개체를 삭제하거나 전달하여 알림 수신을 중지하는 데 사용할 수 있는 토큰 개체 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

관찰할 개체입니다.

handler
EventHandler<UIStatusBarOrientationChangeEventArgs>

알림이 게시될 때 호출할 메서드입니다.

반환

토큰 개체를 삭제하거나 전달하여 알림 수신을 중지하는 데 사용할 수 있는 토큰 개체 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 ();

적용 대상