Reputation: 5442
Am trying to show UIKeyboard without using UITextView
and UITextField
. Am following the below source code to show the Keyboard in my app.
UIKeyboard *keyboard = [[[UIKeyboard alloc] initWithFrame: CGRectMake(0.0f, 220.0f, 320.0f, 216.0f)] autorelease];
[keyboard setReturnKeyEnabled:NO];
[keyboard setTapDelegate:editingTextView];
but the code showing below errors,
Use of undeclared identifier 'UIKeyboard'
Use of undeclared identifier 'keyboard'
Anyone please help to solve this error? and please tell me this is the right way to show keyboard without using UITextView
and UITextField
?
Upvotes: 0
Views: 857
Reputation: 13364
You can use UIKeyInput
delegate.
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController<UIKeyInput>
And in your ViewController.m
class. return YES;
to canBecomeFirstResponder:
-(BOOL)canBecomeFirstResponder
{
return YES;
}
It will show you keyboard
. But Where you write if there is no UITextView
or UITextField
.
Well for writing on UIView
see this logics - UIKeyInput- Displaying keyboard in iPhone without UITextField or UITextView
Upvotes: 1