tags:

views:

166

answers:

1

Hi,

I have a UITextField which I am adding programatically. I want to set the touch down event of that UITextField, that is when user clicks on the textfield second time it should resign from being first responder. THat means the key board should disappear.

A: 

UITextField inherits from UIControl, so you should be able to do what you want by implementing touchesBegan: and checking to see if the UITextField is already firstResponder. If it is, just send a resignFirstResponder message to the UITextField object.

mmc