Reputation: 31
I'm having some class which is a subclass of UITableViewController. on one of the TableView's cell I'm adding a view that holds a UIButton as subview (i.e. [someParentView addsubview:button]) I'm adding the view to cell like this: [cell.contentView addSubview:someParentView]
I've set the UserInteractionEnabled both for the button and for the view holding it ("someParentView") to YES but still when I tap it, nothing seems to be happening.
any idea?
Thanks
What i want to accomplish in short: i want to make a tableview that shows some views. each view contains some subviews, and in one of those cases there is a uibutton as a subview. i want to have this button to trigger event by user's tap, as any other uibutton, so some method will be launched.
to do that, i made a class which subclasses UITableViewController, and for each cell i added a view using [cell.contentView someView], as i wrote. i disabled selection from all using the [self.tableview setAllowSelection:NO] and for each sell made selection style as NONE. as said, i also set the view and the uibutton UserInteractionEnabled property to YES. anything i'm missing?
Upvotes: 0
Views: 689
Reputation: 31
Been solved! I have used the method:
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
of UIView
class in my subclass and returned the button as the returned object.
(of course, needed to test point if in button area).
Upvotes: 1