HowTo: Dismiss the Keyboard
From $1
Table of contents
If you want to dismiss the keyboard once it has popped up on the screen, you need to call the ResignFirstResponder method, like this:
myTextField.ResignFirstResponder ();
Usually, you want to handle that when the user hits the [Return] button on the popup keyboard. A simple way of configuring this is to assign a lambda function to your ShouldReturn property in the UITextField.
The C# 3.0/Lambda style:
void Setup ()
{
var text = new UITextField (someRect);
text.ShouldReturn = (tf) => {
tf.ResignFirstResponder ();
return true;
}
}
The C# 2 style:
void Setup ()
{
var text = new UITextField (someRect);
text.ShouldReturn = DoReturn;
}
bool DoReturn (UITextField tf)
{
tf.ResignFirstResponder ();
return true;
}
- Tag page
- What links here
[MISSING: skin.common.header-gallery-count]
| Images 0 | ||
|---|---|---|
| No images to display in the gallery. |
Page last modified 00:17, 22 Sep 2009 by Miguel