/iOS-KeyboardHelper

Adjusts view position automatically above Keyboard along with a UIToolBar with buttons: Next, Prev and Done.

Primary LanguageObjective-C

KeyboarHelper adds a inputAccessoryView with Previsou, Next and Done button.

If any textfield or textarea is selected a toolbar with the above buttons 
will be shown just above the keyboard.

Previous button is absent if the first textfield/view is selected and Next button is absent
if the last textfield/view is selected.

A callback to the done button can be assigned as selector or block.

KeyboardHelper works with a ViewController object.
Example:

Step 0: Add the files:

Add the KeyboardHelper folder into your project. It has just two files:
1. KeyboardHelper.h
2. KehboardHelper.m


Step 1: Declare a property
...
#import "KeyboardHelper.h"
...
...
@property (nonatomic, strong) KeyboardHelper* kbHelper;

Step 2: Initialize in viewDidLoad method
// in viewDidLoad method:
// using selector
self.kbHelper = [[KeyboardHelper alloc] initWithViewController:self onDoneSelector:@selector(onDone)];

// using block
self.kbHelper = [[KeyboardHelper alloc] initWithViewController:self onDoneAction:^(void){
		NSLog(@"On Done!!");
	}];
	
NOTE: If view is not loaded, there will be an exception

Step 3: Enable/Disable
Since KeyboardHelper observs UIKeyboardWillShowNotification and UIKeyboardWillHideNotification,
it needs to be remove itself from observing before the view disappears.

- (void) viewWillAppear:(BOOL)animated{
	[self.kbHelper enable];
}
- (void) viewWillDisappear:(BOOL)animated{
	[self.kbHelper disable];
}


Step 4: Delegates
KeyboardHelper sets itself as delegate to all the UITextField and UITextView present 
in the viewcontroller it initialized with.

So, it exposes these two properities allowing any external delegate:

1. textViewDelegate
2. textFieldDelegate


Known Issues:
1. Doesn't work well in Landscape mode.
2. Landscape right orientation is not supported.


THANKS FOR ANY FEEDBACK AND BUG REPORT :)

Blog Link: http://amanpages.com/wordpress/iphone-app-development-core-sdk-cocoa/keyboard-helper-for-iphone-apps-using-inputaccessoryview-with-previous-next-and-done-buttons/