0

I have a standard UITableViewController. In the cellForRowAtIndexPath I add a subview to cell.contentView. This UIView itself contains a UITextField object. This object will not respond to touches. I have set the delegate to the UIView and implemented all the methods. I have also set userInteractionEnabled = YES. When I tap the UITextField nothing happens! I feel it's being absorbed by the cell. What would be the easiest, least messy fix?

Best, Joris

EDIT: Sorry, see my answer. I solved it.

Joris Weimar
  • 4,783
  • 4
  • 33
  • 53

4 Answers4

1

I'm an idiot. Sorry for wasting everyone's time. I hadn't properly said the UIView's frame. It of course did display the UI elements, but wouldn't respond to them.

Joris Weimar
  • 4,783
  • 4
  • 33
  • 53
0

Try just adding the textfield as a subview of the cell, this is what I have done in a couple of my apps and had no problems with it

Dan F
  • 17,654
  • 5
  • 72
  • 110
0

In your tableView, try to set

allowsSelection = NO;
MatLecu
  • 953
  • 8
  • 14
0

Try setting the editing property of the table view to YES. Check this answer

Editing a UITextField inside a UITableViewCell fails

Community
  • 1
  • 1
Narayanan
  • 785
  • 2
  • 6
  • 5