Adding tool bar on top of the uikeyboard Adding tool bar on top of the uikeyboard ios ios

Adding tool bar on top of the uikeyboard


I think, you want an inputAccessoryView.

Basically, you create a view and set it as a text field's or text view's input accessory view.

[textField setInputAccessoryView:inputAccessoryView];


Here is code in case someone else need it.Found on stack overflow

- (void)viewDidLoad{    [super viewDidLoad];    UIToolbar* numberToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];    numberToolbar.barStyle = UIBarStyleBlackTranslucent;    numberToolbar.items = [NSArray arrayWithObjects:                         [[UIBarButtonItem alloc]initWithTitle:@"Clear" style:UIBarButtonItemStyleBordered target:self action:@selector(clearNumberPad)],                         [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],                         [[UIBarButtonItem alloc]initWithTitle:@"Apply" style:UIBarButtonItemStyleDone target:self action:@selector(doneWithNumberPad)],                     nil];    [numberToolbar sizeToFit];    numberTextField.inputAccessoryView = numberToolbar;}-(void)clearNumberPad{    [numberTextField resignFirstResponder];    numberTextField.text = @"";}-(void)doneWithNumberPad{    NSString *numberFromTheKeyboard = numberTextField.text;    [numberTextField resignFirstResponder];}


https://github.com/asefnoor/IQKeyboardManager

This is the best keyboard handler I have seen. Very excellent way to manage Text inputs.

Some of its features 1) ZERO LINE OF CODE

2) Works Automatically

3) No More UIScrollView

4) No More Subclasses

5) No More Manual Work

6) No More #imports