How to display a custom view instead of standard keyboard when the textfield becomes first responder?

This snippet deals with how to display custom view instead of keyboard when the textfield becomes first responder…

 

Write the highlighted code, as shown below, in .h file

Now come to .m file and write the code give below

@synthesize field;

Inside viewDidLoad method write the following code

UIImage *image=[UIImage imageNamed:@"apple-logo.jpg"];
	UIImageView *view=[[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 100, 200.0f)];
	[view setImage:image];

	field.inputView=view;

Here apple-logo.jpg is the image in the resource folder

 

Now come to .xib

Add a textfield and a label as shown below. Also make the connection

Now when you interact with textfield you will get your own view instead of keyboard