편집

다음을 통해 공유


UIKeyboard Class

Definition

The iPhone virtual keyboard.

[ObjCRuntime.Unavailable(ObjCRuntime.PlatformName.TvOS, ObjCRuntime.PlatformArchitecture.All, null)]
public static class UIKeyboard
type UIKeyboard = class
Inheritance
UIKeyboard
Attributes

Remarks

The UIKeyboard class contains constants and methods to track the visibility of the iPhone virtual keyboard. iOS posts a number of notifications when the keyboard is shown, hidden or moved in the screen.

The preferred way of receiving UIKeyboard notification is to use the UIKeyboard.Notifications class, which provides a strongly-typed set of APIs to track the changes to the keyboard state and provides strongly-typed accessors to the various parameters of the keyboard changes.

//
// Lambda style
//

// listening
notification = UIKeyboard.Notifications.ObserveDidChangeFrame ((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, 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.ObserveDidChangeFrame (Callback);
}

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

Properties

AnimationCurveUserInfoKey

Represents the value associated with the constant UIKeyboardAnimationCurveUserInfoKey

AnimationDurationUserInfoKey

Represents the value associated with the constant UIKeyboardAnimationDurationUserInfoKey

BoundsUserInfoKey

Represents the value associated with the constant UIKeyboardBoundsUserInfoKey

CenterBeginUserInfoKey

Represents the value associated with the constant UIKeyboardCenterBeginUserInfoKey

CenterEndUserInfoKey

Represents the value associated with the constant UIKeyboardCenterEndUserInfoKey

DidChangeFrameNotification

Notification constant for DidChangeFrame

DidHideNotification

Notification constant for DidHide

DidShowNotification

Notification constant for DidShow

FrameBeginUserInfoKey

Represents the value associated with the constant UIKeyboardFrameBeginUserInfoKey

FrameEndUserInfoKey

Represents the value associated with the constant UIKeyboardFrameEndUserInfoKey

IsLocalUserInfoKey
WillChangeFrameNotification

Notification constant for WillChangeFrame

WillHideNotification

Notification constant for WillHide

WillShowNotification

Notification constant for WillShow

Methods

AnimationCurveFromNotification(NSNotification)

Deprecated: helper method to extract the animation curve from a notification.

AnimationDurationFromNotification(NSNotification)

Deprecated: helper method to extract the animation duration from a notification.

BoundsFromNotification(NSNotification)

Developers should not use this deprecated method.

CenterBeginFromNotification(NSNotification)

Deprecated: helper method to extract the center start from a notification

CenterEndFromNotification(NSNotification)

Deprecated: helper method to extract the center end from a notification.

FrameBeginFromNotification(NSNotification)

Deprecated: helper method to extract the keyboard's starting frame from a notification

FrameEndFromNotification(NSNotification)

Deprecated: helper method to extract the keyboard's ending frame from a notification

Applies to

See also