Home > Tutorials Home > Ios > UITextfield Demo in iPhone

UITextfield Demo in iPhone

Published on October 17, 2019 8:05:45 PM


We are an online tutoring company that has laid its foundation in utilizing Multiple Intelligence methodology to understand specific needs and learning styles of a student.UITextField show how to add the value of two different textfield and printing it in another textfield.So that we patch a particular student to a tutor having a compatible teaching style. We have devised a smart online tutoring system to give you measurable results.Schools, cramped with students, fail to give your child the edge, the motivation and the right teacher guidance to help him find the true potential. We at make sure that your child gets the perfect learning environment to outperform.

Step 1 : Open the XCode and create a new Single View Based Application template. Give the application name "TextField Example". Copy this Code to the ViewController.h

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController<UITextFieldDelegate>

@property (weak, nonatomic) IBOutlet UITextField *txtFirstName;
@property (weak, nonatomic) IBOutlet UILabel *lblMessage;

- (IBAction)clickEvent:(id)sender;


Step 2 : Copy the Following Code into your ViewController.m File.

#import "ViewController.h"

@implementation ViewController

@synthesize txtFirstName;
@synthesize lblMessage;

- (IBAction)clickEvent:(id)sender
	[lblMessage setText:[NSString stringWithFormat:@"Welcome, %@",[txtFirstName text]]];
	[txtFirstName resignFirstResponder];

//Delegate Method

- (BOOL)textFieldShouldReturn:(UITextField *)textField
    [txtFirstName resignFirstResponder];
	[lblMessage setText:[NSString stringWithFormat:@"Welcome, %@",[txtFirstName text]]];
	return YES;

// called when 'return' key pressed. return NO to ignore.


UITextfield Demo in iPhone - Video Tutorial