Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

loon3y

macrumors 65816
Original poster
Oct 21, 2011
1,235
126
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.
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
9,560
6,059
When the background receives a touch, send resignFirstResponder to whichever textfield is the one that the user is currently typing in.
 

loon3y

macrumors 65816
Original poster
Oct 21, 2011
1,235
126
When the background receives a touch, send resignFirstResponder to whichever textfield is the one that the user is currently typing in.

would it be something like this?

Code:
- (IBAction)backgroundTouch:(id)sender {
    [displayText resignFirstResponder];
}
 

loon3y

macrumors 65816
Original poster
Oct 21, 2011
1,235
126
would it be something like this?

Code:
- (IBAction)backgroundTouch:(id)sender {
    [displayText resignFirstResponder];
}



this code didn't work for scroll view, it works for regular view.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.