I've got a UIButton
inside a UITableViewCell
which is held in a table, which is owned by my UITableViewController
subclass. I'm trying to make use of the feature of target/action pairs where it can bubble up events to its next responder until it finds a responder which can handle the event, but I'm not getting this to work. Some code:
In my table cell, I setup my button like so:
[self.button addTarget:nil action:@selector(doThing) forControlEvents:UIControlEventTouchUpInside];
The button gets added to my cell, and the cell displays just fine in the tableview. Since I've passed nil
in for the target, this event should bubble up until it hits my View Controller, which implements -doThing
, but it doesn't get called.
I've overriding - (BOOL)canBecomeFirstResponder
and return YES
both in the cell subclass and in my view controller subclass, but even combined, it still doesn't work.
I've debugged to see that both the button and the view controller are in the same responder chain, yet somehow, the event doesn't seem to make it up.
Any ideas?