- (BOOL)textField:(UITextField *)textField...

Discussion in 'iOS Programming' started by XcodeNewb, Feb 8, 2009.

  1. XcodeNewb macrumors member

    Joined:
    Feb 6, 2009
    #1
    Anyone know how to prevent the keyboard from calling the delegate method shouldChangeCharactersInRange when the "Return" key is pressed?

    I am limiting the textfield to 3 characters but if you type in 3 characters and then hit "Return" it thinks you are typing another character and it ignores the keystroke and is never able to call the "Did End on Exit" method to resign the first responder and hide the keyboard.

    Thanks in advance
     
  2. sujithkrishnan macrumors 6502

    Joined:
    May 9, 2008
    Location:
    Bangalore
    #2
    I think u need to write this delegate method.
    - (BOOL)textFieldShouldReturn:(UITextField *)textField{
    [textField resignFirstResponder];
    return YES;
    }
     

Share This Page