Thursday, 27 September 2012

How to Custom UIKeyBoard for UITextField

                          Custom UIKeyboard 

   UITextField contains two properties

       // set while first responder, will not take effect until reloadInputViews is called.
@property (readwrite, retain) UIView *inputView;             
@property (readwrite, retain) UIView *inputAccessoryView;


Can use our custom UIView instead of system keyboard by using inputView property, create your own  UIView and assign to the inputView property.
              yourtxtfield.inputView = yourCustomKeyboardUIView;  
can switch our custom keyboard and  system keyboard by using  reloadInputViews (Updates the custom input and accessory views when the object is the first responder)

  change custom keyboard to system keyboard

            yourtxtfield.inputView = nil;
            [yourtxtfield  reloadInputViews];

 change system keyboard to custom keyboard
            youttxtfield.inputView = yourCustomKeyboardUIView;
            [self.kbtxtfield reloadInputViews];

replaced system keyboard by our custom UIView


Can add a toolbar like view on top of system keyboard by using inputAccessoryView property, create your own UIView and assign to the property.

              yourtxtfield.inputAccessoryView = yourCustomtoolbarlikeUIView;
added toolbar like view on top of system keyboard using inputAccessoryView

This sample describes how to add a toolbar(input AccessoryView) on top of system keyboard and how to add a custom keyboard by replacing system UIKeyboard. you can also switch between custom view and system keyboard ,this sample used xib for custom keyboardview and inputAccessoryView, also describes that how to use Custom UIView and  XIB UIView.

download source code :


  1. nice blogs.
    Friend chatMake new friend’s without revealing yourself. Dial 543216 at Rs 2/min and monthly subscription of Rs 30/ 30 days.