About done button in keypad

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

  1. macrumors 6502

    iphonejudy

    Joined:
    Sep 12, 2008
    #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

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Why not just put the Done button on the keyboard, like so:
    Code:
    textfield.returnKeyType = UIReturnKeyDone;
     
  3. thread starter macrumors 6502

    iphonejudy

    Joined:
    Sep 12, 2008
    #3


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

    iphonejudy

    Joined:
    Sep 12, 2008
    #4


    Thanks.i finished the task.
     

Share This Page