1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

About done button in keypad

Discussion in 'iPhone/iPad Programming' started by iphonejudy, Dec 2, 2008.

  1. macrumors 6502

    iphonejudy

    #1
    Hi,

    When i edited the text,the keypad is open.But it has no done button to close the keypad.

    So,i create a button and write the below code.
    //When done buton click
    - (IBAction)doneButtonOnKeyboardPressed: (id)sender
    {
    [textField resignFirstResponder];

    }
    - (BOOL)textFieldShouldReturn:(UITextField *)theTextField {
    if(theTextField == textField)
    [textField resignFirstResponder];
    return YES;
    }

    So i want to display this button when keypad open(When the page load it should be hidden)

    I tried this in,

    - (void)viewDidLoad {
    button.hidden=true;
    }

    But its not working.
    Can anybody please tell me the code?

    1)To hide the button when view load.
    2)To display button when keypad opens.

    Thanks
    judy
     
  2. Moderator

    dejo

    Staff Member

    #2
    Why not just put the Done button on the keyboard, like so:
    Code:
    textfield.returnKeyType = UIReturnKeyDone;
     
  3. macrumors 6502

    iphonejudy

    #3


    In which event i need to write the code ?
     
  4. macrumors 6502

    iphonejudy

    #4


    Thanks.i finished the task.
     

Share This Page