Getting text from UILabel from UITextField in Objective-C

How to get data from UITextField to display it on UILabel for beginner iOS developers by XCode IDE in Objective-C language.

UILabl is read-only text in 1-3 lines. UITextFields is a Single Line of editable text like HTML Textbox. You can set vaious visual aspects such as the front family, font size and color in UITextField. In UILable You can setting properties such as the font type and color too.

First new project use "Single View Application".

Next design and aligment the object in ViewController like this:

Put the UILable above UITextField with empty value.

Hold "control" button and drag UILabel, UITextField to Connect with ViewController.h file create the IBOutlet name "label" and "txt_name".

Drag Round Rect Button with control keyboard to connect with ViewController.h create IBAction name "Submit_Command"

Check ViewController.h file:

#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *label;
@property (weak, nonatomic) IBOutlet UITextField *txt_name;

Open "ViewController.m" and synthersize "label" like this:

#import "ViewController.h"
@implementation ViewController
@synthesize label;

Create IBAction in ViewController.m with this Code:

    [txt_name resignFirstResponder]; 

Remark: If you have auto hide keyboard in iPhone Device insert this method in ViewController.m

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    [self.txt_name resignFirstResponder];

Link "Submit_Command" with "Touch Up Inside" with Round Rect Button in MainStoryBoard

"Run" your project:

Complete this tutorial
see more Thai iOS Developer