Hi
i try to implement customkeyboard with UISearchBar .first of all my mainclass.h where i use UISearchBar is look like this
Now my mainclass.m
In SearchBar.h
in SearchBar.m
And then finally i have PashtoKeyboard.h and PashtoKeyboard.m where i create my custom keyboard,due to large coding i not show these classes code here but its works fine with textveiw and textfield.
But it not works for me with UISearchBar .can some one guide me how to do this.thanx
i try to implement customkeyboard with UISearchBar .first of all my mainclass.h where i use UISearchBar is look like this
Code:
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@class PashtoKeyboard;
@class SearchBar;
@interface MainViewController : UIViewController<UISearchBarDelegate, UITextViewDelegate> {
IBOutlet SearchBar *searchBar;
PashtoKeyboard *pashtoKeyboard;
}
@property(nonatomic,retain) PashtoKeyboard *pashtoKeyboard;
@property (nonatomic,retain) SearchBar *searchBar;
@end
Now my mainclass.m
Code:
#import "MainViewController.h"
#import "PashtoKeyboard.h"
#import "SearchBar.h"
@implementation MainViewController
@synthesize pashtoKeyboard,searchBar;
- (void)viewDidLoad
{
[super viewDidLoad];
//Create Pashto Keyboard
PashtoKeyboard *pashtoKey = [[PashtoKeyboard alloc] initWithFrame:CGRectMake(0.0, 460.0-216.0, 320.0, 216.0)];
[pashtoKey loadView];
//[self.view addSubview:hebKey];
[pashtoKey addTarget:self action:@selector(pashtoKeyboard_clicked:) forControlEvents:1001];
[pashtoKey addTarget:self action:@selector(pashtoKeyboardBackspace_clicked:) forControlEvents:1002];
[pashtoKey addTarget:self action:@selector(pashtoKeyboardEnter_clicked:) forControlEvents:1003];
[self setPashtoKeyboard:pashtoKey];
//[hebKey setHidden:YES];
[pashtoKey release];
searchBar.inputView = pashtoKey;
searchBar.delegate=self;
searchBar.userInteractionEnabled=YES;
}
#pragma mark Pashto Keyboard Methods
- (void) pashtoKeyboard_clicked:(id)sender{
[searchBar setText:[pashtoKeyboard keyboardText]];
}
- (void) pashtoKeyboardBackspace_clicked:(id)sender{
[searchBar setText:[pashtoKeyboard keyboardText]];
}
- (void) pashtoKeyboardEnter_clicked:(id)sender{
[textView setText:[pashtoKeyboard keyboardText]];
}
In SearchBar.h
Code:
#import <UIKit/UIKit.h>
@interface SearchBar : UISearchBar {
}
@property (readwrite, retain) UIView *inputView;
@end
Code:
#import "SearchBar.h"
@implementation SearchBar
@synthesize inputView;
- (void)dealloc {
[super dealloc];
}
@end
But it not works for me with UISearchBar .can some one guide me how to do this.thanx
Last edited: