HowTo: Keyboard Displayed Notification

From $1
Table of contents

If you want to register a notification for when the keyboard on the iPhone has been shown on the screen, you can use the following code snippet:

using MonoTouch.Foundation;
[..]

NSNotificationCenter.DefaultCenter.AddObserver (
    "UIKeyboardDidShowNotification", MyNotification);
[..]

void MyNotification (NSNotification notification)
{
    Console.WriteLine ("The keyboard went up");
}

Or if you rather use the C# Lambda syntax:

using MonoTouch.Foundation;
[..]

NSNotificationCenter.DefaultCenter.AddObserver (
    "UIKeyboardDidShowNotification", (notification) => { 
        Console.WriteLine ("Keyboard went up");
    });

 

Tag page

Files (0)

 
Page last modified 00:06, 22 Sep 2009 by Miguel