Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Mobile-Applications Keyboard Done button in iphone

Have Programming Question? Ask it here!
 
 
 


samar
Keyboard Done button in iphone
1 Answer(s)      3 years and 6 months ago
Posted in : MobileApplications


hii,,

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


Advertisement
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, For making keyboard Done button press :- import keyboard displacement by adding this line #define kOFFSET
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
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
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... when button is clicked. so to create iphone buttons on window will write
info button iphone example
info button iphone example  I'm looking for a simple info button example in iPhone XCode. Thanks
handling Button Event in iphone
handling Button Event in iphone  handling Button Event in iphone
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... on clicking the button in iPhone SDK. For the audio we are going to use...... you can play the sound on clicking the button. Download AVAudioplayer iPhone
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
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
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
iphone button change view
iphone button change view Final application will look like this:       In this tutorial will learn button change view i.e. when button is clicked will move to next view. This application is View Based
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
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
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.  
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 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
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 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
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
iPhone Picker Object On Toolbar Button
iPhone Picker Object On Toolbar Button In this tutorial will learn how to use... Ok or Done button and is added to the Toolbar. Then is viewDidLoad method will add all the actions which is done in iphone programming using an array variable
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
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
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
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
disable keyboard in java applet
disable keyboard in java applet  How to disable key board of my client in an java applet embedded in a website while the applet is running.? Plz help
Button
Button  How to use image for button in JSF
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
java keyboard shortcuts - Struts
java keyboard shortcuts  hi, i hav an application already developed using struts framework.now i would like to add some keboard shortcuts to my application, so that the user need not to go for the usage of the mouse every time
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
button
button  can i give multiple commands on click of a button? if yes how can i do that?? multiple commands can we retriving dat from database, capturing data, moving to next page.. etc
button
button  can i give multiple commands on click of a button? if yes how can i do that?? multiple commands can be retriving dat from database, capturing data, moving to next page.. etc
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... the Toolbar style and the style of the Toolbar Button is changed, so to do
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. Thanks   Hi, You can use the following code
Keyboard Input
Java NotesKeyboard Input There are two approaches to getting keyboard input from the user. GUI (Graphical User Interface). Displaying a graphical text... simple keyboard input, eg, something like C++'s cin. Java 5 (introduced
Google Android G1 vs Apple iPhone 3G
built on completely different platforms. Although the iPhone 3G has done pretty... customisable controls and a QWERT keyboard for easy navigation the iPhone still features easier control and navigation on its button-less and physical keyboard
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
Advertisements
 

 

 

DMCA.com