I cant believe that I haven't been able to find any documentation on this yet but I was wondering how to command the keyboard to activate and receive input from it. All of the examples I could find where for manipulating the keyboard that would pop up because of a text field being edited. Thanks
A:
I eventually decided to create a text field that is hidden from view and was selected by:
[text_input becomeFirstResponder];
jcb344
2010-06-24 21:45:43
+1
A:
You can also use the UIKeyInput protocol to request a keyboard without having to create a hidden text field.
@interface My : UIViewController <UIKeyInput> ...
and then something like this in the implementation
// Methods which make the keyboard work
- (BOOL) hasText
{
return YES;
}
- (void)deleteBackward
{
[self handleBackspace];
}
- (void) insertText:(NSString* )text
{
int n = [text length];
int i;
for (i = 0; i < n; i++)
{
[self handleKey:[text characterAtIndex:i]];
}
}
- (BOOL) canBecomeFirstResponder
{
return YES;
}
// Methods to manage the appearance of the keyboard
- (void) summonKeyboard
{
[self becomeFirstResponder];
}
- (void) dismissKeyboard
{
[self resignFirstResponder];
}
mtoy
2010-06-30 01:56:33