Keyboard Done button in iphone

Keyboard Done button in iphone

hii,,

how can i set a function on press keyboard done button.

View Answers

October 28, 2010 at 12:09 PM

hello,

For making keyboard Done button press :-

import keyboard displacement by adding this line

#define kOFFSET_FOR_KEYBOARD  80.0

here you can set 80.0 according to your need

-(void)textFieldDidBeginEditing:(UITextField *)sender
{

    if ([sender isEqual:TextField])
    {

        if  (self.view.frame.origin.y >= 0)
        {
            [self setViewMovedUp:YES];
        }
    }
}

-(void)setViewMovedUp:(BOOL)movedUp
{
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.5];  
    CGRect rect = self.view.frame;
    if (movedUp)
    {
                rect.origin.y -= kOFFSET_FOR_KEYBOARD;
        rect.size.height += kOFFSET_FOR_KEYBOARD;
    }
    else
    {
        // revert back to the normal state.
        rect.origin.y += kOFFSET_FOR_KEYBOARD;
        rect.size.height -= kOFFSET_FOR_KEYBOARD;
    }
    self.view.frame = rect;

    [UIView commitAnimations];
}


- (void)keyboardWillShow:(NSNotification *)notif
{


    if ([TextField isFirstResponder] && self.view.frame.origin.y >= 0)
    {
        flag=YES;

        [self setViewMovedUp:YES];
    }
    else if (![TextField isFirstResponder] && self.view.frame.origin.y < 0)
    {
        [self setViewMovedUp:NO];
    }
}




- (void)viewWillAppear:(BOOL)animated
{
    // register for keyboard notifications
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector

(keyboardWillShow:)

                 name:UIKeyboardWillShowNotification object:self.view.window]; 
}

- (void)viewWillDisappear:(BOOL)animated
{
    // unregister for keyboard notifications while not visible.
    [[NSNotificationCenter defaultCenter]

removeObserver:self name:UIKeyboardWillShowNotification object:nil]; }

-(void) touchesBegan :(NSSet *) touches withEvent:(UIEvent *)event
{

    //NSLog(@"%@",flag);
    if (flag==TRUE)
    {
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.5];
    CGRect rect = self.view.frame;
    rect.origin.y += kOFFSET_FOR_KEYBOARD;
    rect.size.height -= kOFFSET_FOR_KEYBOARD;
    self.view.frame = rect;

    [UIView commitAnimations];
        flag=FALSE;
    }
    [TextField resignFirstResponder];
        [super touchesBegan:touches withEvent:event ];
}









Related Tutorials/Questions & Answers:
Keyboard Done button in iphone
Keyboard Done button in iphone  hii,, how can i set a function on press keyboard done button.   hello,ADS_TO_REPLACE_1 For making keyboard Done button press :- import keyboard displacement by adding this line
uikeyboard done button/return button
uikeyboard done button/return button  Hi everyone!!! Just worried about ..how to return the UIKeyboard on done or return button click in my iPhone...; button2.delegate = self; } // dismiss the keyboard then the "done" button is clicked
Advertisements
hide show keyboard iphone
hide show keyboard iphone  How to hide show keyboard in iPhone programmatically
hide show keyboard iphone
hide show keyboard iphone  How to hide show keyboard in iPhone programmatically
hide show keyboard iphone
hide show keyboard iphone  How to hide show keyboard in iPhone programmatically
hide keyboard iphone
hide keyboard iphone  Can anyone tell me how to hide keyboard in my simple view based application in iphone?   Hiding keyboard in iPhone - (BOOL)textFielsShouldReturn:(UITextField *)textField { [textField
uitableview edit done button
uitableview edit done button  How to add Edit / Done button in UITableView with an action on click?   UITableview Edit done Button To add " Edit / Done button " in UITableView add the given code in UIView Controller
iPhone Button Image
iPhone Button Image In this tutorial will learn how to Create iPhone Button image and also how to set the image on button click on the view, this will be done using code. We are not going to using Interface Builder to add Button, whole
handling Button Event in iphone
handling Button Event in iphone  handling Button Event in iphone
home button macbook pro keyboard
home button macbook pro keyboard  what is the substitute of Home and End button on macbook pro keyboard?   Home = Function Key (Fn) + Left Arrow End = Function Key (Fn) + Right Arrow
info button iphone example
info button iphone example  I'm looking for a simple info button example in iPhone XCode. Thanks
iphone button click event
iphone button click event  Hi, How to write iphone button click event? Thanks   Hi, Here the method declaration: -(IBAction) myMetod...{ NSLog(@"Button clicked"); } Thanks
iPhone Radio Button Example
iPhone Radio Button Example  Can you please suggest me how to create Radio button in my iPhone application. Actually, in my application i have two... click on that button it get selected and by default it should display unselected
iPhone Detail Disclosure Button
iPhone Detail Disclosure Button In iPhone based applications, detail disclosure are used to show the detailed information of list items. On clicking it .. it'll bring up the detail information about the item in list. We can also say
iPhone Button Click Sound
iPhone Button Click Sound In this series of iPhone button tutorial, we are going to create a small iphone application that is going to play a sound on clicking the button in iPhone SDK. For the audio we are going to use
How to Create Button With TableView in iphone
How to Create Button With TableView in iphone  My requirement is i am creating one button. when i press the button TableView will display... on the button can u please send me the code i want to create converter app. thanks
iphone button example
 iphone button example In this tutorial we will tell you how to change the type of button in Interface Builder. There are six types of iPhone button...; 6.Add contact.     Custom: is used when an image is set on button
uitextfield hide keyboard on return
the keyboard when use clicks on the return button of the iPhone keyboard. Thanks...uitextfield hide keyboard on return  I am working on a iPhone project. I want to hide the keyboard when use clicks on the return button of the IOS
Change Button Text iPhone
Change Button Text iPhone In a UINavigationController based application, most of the time you can find that the back button on TopView shows the same title.... But luckily we can change the button text in iPhone app. Find the given code
How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA or Net Beans ???
How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA or Net Beans ???  How can change Button Label value Every Time when i start Virtual Keyboard, Means ,if 1st time Button1=''a'' then next login time
How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA or Net Beans ???
How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA or Net Beans ???  How can change Button Label value Every Time when i start Virtual Keyboard, Means ,if 1st time Button1=''a'' then next login time
iphone button change view
iphone button change view Final application will look like this:      ADS_TO_REPLACE_1 In this tutorial will learn button change view i.e. when button is clicked will move to next view. This application
Iphone keypad app
Iphone keypad app The given sample "Iphone keypad app" is going to show you how to hide keyboard or number pad and return to the actual screen. We... a Textfield to get some input from the user. Once user is done, the application must
iphone Button Action (changing background of window)
iphone Button Action (changing background color of window)   In this tutorial we will change the background color on clicking the button...;Orange" button is pressed, it will call the doOrange function.  
resign first responder keyboard
resign first responder keyboard  Hi, How I can hide keyboard on click on of done button in keyboard. Give me example of resign first responder keyboard example code. Thanks   Hi, Make your controller delegate to text
HIDE BUTTON iPHONE
HIDE BUTTON iPHONE Basically,buttons are used to give an action... wanted to restrict the user from clicking the button. In other way we can say that we are hiding button from the users until and unless the condition is true
iphone
iphone  hiii, how can we use table recursively in iphone
iphone
iphone  hello... i want to make first iphone application . How can i make it plz help me
iphone
iphone  How can connect with the other database in iphone application(like... MYsql or oracle) is this dirctly possible
iPhone Picker Object On Toolbar Button
iPhone Picker Object On Toolbar Button In this tutorial will learn how to use Picker view, also the Toolbar and on that will place Toolbar button... the actions which is done in iphone programming using an array variable which we created
iPhone Keyboard Hides TextField
iPhone Keyboard Hides TextField Previous example of "..., the keyboard appears, but it appears right over the text field! In most cases of iPhone application, keyboard hides the text fields that restricts a user from
uitextfield disable keyboard
uitextfield disable keyboard  How to disable keyboard of UITextView in iPhone SDK application?   There are two ways to disable the keyboard of UITextField in iPhone SDK application - (BOOL)textFieldShouldBeginEditing
keyboard shortcuts - Swing AWT
keyboard shortcuts  Hello, i m facing problem in invoking a button it is an arrow button. although the user can click on it with a mouse... when we press the upper arrow from the keyboard that button should be invoked
keyboard input
keyboard input  how do I use JOptionPane to accept keyboard input? I know how to import but not specific command on input line   import javax.swing.*; class JOPtionPaneExample { public static void main(String
iphone Curl Image
iphone Curl Image In this tutorial will learn how to change the image on button click in curl format, this is done by coding. This application will be based on View Based Application and the coding will be done only in View Controller
Google Android G1 vs Apple iPhone 3G
built on completely different platforms. Although the iPhone 3G has done pretty... button-less and physical keyboard-less design. Simply put out of the two... Google Android G1 vs Apple iPhone 3G  
How to connect on screen keyboard to system.
How to connect on screen keyboard to system.  How to connect on screen keyboard to system.I made on screen keyboard in java(swing).Now i want connect to system means when i pressed any button then it type on notepad or any
How to connect on screen keyboard to system.
How to connect on screen keyboard to system.  How to connect on screen keyboard to system.I made on screen keyboard in java(swing).Now i want connect to system means when i pressed any button then it type on notepad or any
iPhone Development
iPhone Development Apple Inc. in June 2007 had created a revolution by launching an incredible internet mobile phone, iPhone that had some amazing features like virtual keyboard, wireless internet connection through 3G spectrum
iPhone resignfirstresponder
iPhone resignfirstresponder  Hi, Provide me a good example of iPhone resignfirstresponder. I need a code to hide keyboard when use clicks outside the text box. ThanksADS_TO_REPLACE_1   Hi, You can use the following
iPhone Segments Changes ToolBar And ToolBar Button
iPhone Segments Changes ToolBar And ToolBar Button In this tutorial will learn... by another Segmented Controller will change the ToolBar Button Style, this is View... Controller is pressed the Toolbar style and the style of the Toolbar Button is changed
How to display windows virtual keyboard
How to display windows virtual keyboard  Hi, I have a jsp file which contains my website design. In my jsp website design, there's a button. I need to display windows virtual keyboard when i press the button. how to do
Button
Button  How to use image for button in JSF
ModuleNotFoundError: No module named 'done'
ModuleNotFoundError: No module named 'done'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'done' How to remove the ModuleNotFoundError: No module named 'done' error
ModuleNotFoundError: No module named 'done'
ModuleNotFoundError: No module named 'done'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'done' How to remove the ModuleNotFoundError: No module named 'done' error
Button with Image
Button with iPhone Image In the given Iphone SDK tutorial, we are creating a button with iPhone image on it. There is nothing in adding Images of Iphone... toolbar...lets find out the steps. Steps of adding image on Button into iPhone
ModuleNotFoundError: No module named 'keyboard'
ModuleNotFoundError: No module named 'keyboard'  Hi, My Python... 'keyboard' How to remove the ModuleNotFoundError: No module named 'keyboard... to install padas library. You can install keyboard python with following
iPhone Multiple View
Based Application. Everything in this is done by coding, the button used...iPhone Multiple View In this iphone tutorial we will show you multiple view, when you press button will take you to another view and also the button type
where the progrming is done in the struts.
where the progrming is done in the struts.  where the progrming is done in the struts.   Hi Friend, You can use EditPlus, Eclipse or NetBeans IDE. For more information, visit the following link: Struts Tutorials
How to Create Keyboard in JAVA
How to Create Keyboard in JAVA  please help me to create On-Screen Keyboard with java and please give me an another idia to make it ..............iam waiting for your help ,think u so much

Ads