Take the 2-minute tour ×

Is there a way you can add a UIView without the view intercepting touches? I tried insertSubview: belowSubview

The reason I want to do this is because I'm adding a UITextField to a UITableViewCell's contentView. But I don't want the UITextField intercepting the touches when I select a row. I know I can set the UITextField userInteractionEnabled property to NO but this leads to a lot of micro management.

share|improve this question
Is there a reason why you don't use a UILabel instead? –  Mike M Oct 9 '12 at 11:25
Because the under is inputting data through the keyboard. –  Peter Warbo Oct 9 '12 at 11:34
how do you envision the user being able to select the text field for entering input versus selecting the entire row? –  Mike M Oct 9 '12 at 11:38
If you tap anywhere outside the text field, the row would be selected. And if you don't want the user to be able to edit the textfield, you will have to disable its interaction. –  lostInTransit Oct 9 '12 at 11:40
@MikeM Selecting the entire row = enter input –  Peter Warbo Oct 9 '12 at 11:41
add comment

1 Answer

Override canBecomeFirstResponder to return NO.

See this info on the Responder Chain.

share|improve this answer
I still want it to become first responder. Only I want to tell it when it should become first responder (in the didSelectRow...) –  Peter Warbo Oct 9 '12 at 12:02
your TextView is inside the Cell. You want to turn around the responder chain for these two elements. Only way is to switch off the responder chain for the TextView. Then in didSelectRow switch it back on and call bacomeFirstResponder programmaticall. Should work. –  ilmiacs Oct 9 '12 at 12:07
add comment

Your Answer


