Hiding Keyboard In ScrollView

Discussion in 'iOS Programming' started by loon3y, Oct 27, 2011.

  1. macrumors 65816

    loon3y

    Joined:
    Oct 21, 2011
    #1
    how can u hide the keyboard when ur in scrollview by touching the background?


    i have textfields but i want the user to be able to hide the keyboard while touching the background, I've already implemented the hide on return key but i know customers are going to complain.
     
  2. macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    When the background receives a touch, send resignFirstResponder to whichever textfield is the one that the user is currently typing in.
     
  3. thread starter macrumors 65816

    loon3y

    Joined:
    Oct 21, 2011
    #3
    would it be something like this?

    Code:
    - (IBAction)backgroundTouch:(id)sender {
        [displayText resignFirstResponder];
    }
    
     
  4. thread starter macrumors 65816

    loon3y

    Joined:
    Oct 21, 2011
    #4


    this code didn't work for scroll view, it works for regular view.
     

Share This Page