iOS Guides | Samples

MonoTouch.UIKit.UIKeyboard.WillHideNotification Property

Notification constant for WillHide

Syntax

[MonoTouch.Foundation.Advice("Use UIKeyboard.Notifications.ObserveWillHide helper method instead.")]
[MonoTouch.Foundation.Field("UIKeyboardWillHideNotification", "UIKit")]
[MonoTouch.ObjCRuntime.Unavailable(MonoTouch.ObjCRuntime.PlatformName.TvOS, MonoTouch.ObjCRuntime.PlatformArchitecture.All, null)]
[get: MonoTouch.ObjCRuntime.Unavailable(MonoTouch.ObjCRuntime.PlatformName.TvOS, MonoTouch.ObjCRuntime.PlatformArchitecture.All, null)]
public static NSString WillHideNotification { get; }

Value

NSString constant, should be used as a token to NSNotificationCenter.

Remarks

This constant can be used with the NSNotificationCenter to register a listener for this notification. This is an NSString instead of a string, because these values can be used as tokens in some native libraries instead of being used purely for their actual string content. The 'notification' parameter to the callback contains extra information that is specific to the notification type.

If you want to subscribe to this notification, you can use the convenience T:UIKeyboard+Notifications.UIKeyboard+Notifications.ObserveWillHideNotification method which offers strongly typed access to the parameters of the notification.

The following example shows how to use the strongly typed Notifications class, to take the guesswork out of the available properties in the notification:

C# Example

//
// Lambda style
//

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

    Console.WriteLine ("FrameBegin", args.FrameBegin);
    Console.WriteLine ("FrameEnd", args.FrameEnd);
    Console.WriteLine ("AnimationDuration", args.AnimationDuration);
    Console.WriteLine ("AnimationCurve", args.AnimationCurve);
});

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

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

    Console.WriteLine ("FrameBegin", args.FrameBegin);
    Console.WriteLine ("FrameEnd", args.FrameEnd);
    Console.WriteLine ("AnimationDuration", args.AnimationDuration);
    Console.WriteLine ("AnimationCurve", args.AnimationCurve);
}

void Setup ()
{
    notification = UIKeyboard.Notifications.ObserveWillHide (Callback);
}

void Teardown ()
{
    notification.Dispose ();
}</code>
          </example>
          <para>The following example shows how to use the notification with the DefaultCenter API:</para>
          <example>
            <code lang="C#"><![CDATA[
// Lambda style
NSNotificationCenter.DefaultCenter.AddObserver (
        UIKeyboard.WillHideNotification, (notification) => {Console.WriteLine ("Received the notification UIKeyboard", notification); }


// Method style
void Callback (NSNotification notification)
{
    Console.WriteLine ("Received a notification UIKeyboard", notification);
}

void Setup ()
{
    NSNotificationCenter.DefaultCenter.AddObserver (UIKeyboard.WillHideNotification, Callback);
}

Requirements

Namespace: MonoTouch.UIKit
Assembly: monotouch (in monotouch.dll)
Assembly Versions: 0.0.0.0