iOS > Hide keyboard when press ‘done’

May 17, 2012   ·   0 Comments

Screen Shot 2012-05-18 at 7.44.30 AM

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController  <UITextFieldDelegate>{
    
    UIButton *m_UIButton01;
    UITextField *m_UITextField01;
    UITextField *m_UITextField02;
}
@property(nonatomic,retain) IBOutlet UIButton *m_UIButton01;
@property(nonatomic,retain) IBOutlet UITextField *m_UITextField01;
@property(nonatomic,retain) IBOutlet UITextField *m_UITextField02;


-(IBAction) Event1:(id)sender;

-(IBAction) Event2:(id)sender;

@end

//
//  ViewController.m
//  myfirstApp
//
//  Created by powen ko on 5/17/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "ViewController.h"

@implementation ViewController

@synthesize   m_UIButton01,m_UITextField01,m_UITextField02;




#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    [m_UITextField01 setText:@"40"];
    [m_UITextField02 setText:@"50"];
    
    m_UITextField01.delegate=self;
    m_UITextField02.delegate=self;
   
}



-(IBAction) Event1:(id)sender{
    NSString* t_string1=[m_UITextField01 text];
    
    
    
    [m_UITextField02 setText:@"100"];
  //  [m_UIButton01 setTitle:@"abc" forState:UIStatus
    
}

-(IBAction) Event2:(id)sender{
    
    [m_UITextField01 resignFirstResponder];
    [m_UITextField02 resignFirstResponder];
    
}




- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [m_UITextField01 resignFirstResponder];
    [m_UITextField02 resignFirstResponder];
}
@end

shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter

By


Readers Comments (0)


You must be logged in to post a comment.

PowenKo’s Online Store

powenko_arduinoBook
iOS Tutorial9

Amazon

adsbygoogle

Recent Posts

Categories

Amazon