0

Done Key in iPhone keyBoard

by Deepak Dhakal 30. May 2009 09:01

 

So You want to add a 'Done' key on iphone , do some specific stuff and make the keywork Invisible .. Then Do the following step.

The Steps below is for when u use Nib file.

 

1. Open NIb file .. Cliick on view and click on the textbox u want to change the keyboard behavior .

2. Open 'Inspector' from the tool menu and change the return key type to 'done'

3. Go to Connection inspector and change the 'delegate' to file owner of the View Controller ( click on + sign and drag to the File's owner )

4. Create a new method in File owner Controller  -(IBAction) pressDoneKey and implement this method and  map 'did end on exit' to this new method

- (IBAction)pressDoneKey
{   
   
    [txtClient resignFirstResponder];
    return YES;
}

where txtClient is a textfield ..

 

like this

 

#import <UIKit/UIKit.h>


@interface ClientGoViewController : UIViewController {
   
    IBOutlet UITextField *txtClient;

}

@property (nonatomic, retain) IBOutlet UITextField *txtClient;

 -(IBAction) pressDoneKey;

@end

 

and U r good to go

 

Tags:

iPhone

Powered by BlogEngine.NET 1.5.0.7
Original Design by Laptop Geek, Adapted by onesoft