My structure of views:
UITableView
UITableViewCell
UIScrollView
CustomView
UIButton
The problem is UIButton doesn't work when I touch it. I create it with code:
btn = [[UIButton alloc] init];
[btn setImage:image forState:UIControlStateNormal];
[btn addTarget:self action:@selector(tileTouchUpInside) forControlEvents:UIControlEventTouchUpInside];
btn.layer.zPosition = 1;
[self addSubview:btn];
I've also add this:
scroll.delaysContentTouches = NO;
scroll.canCancelContentTouches = NO;
But my button doesn't work anyway. I can't cancelContentTouches or set delay for UITableView because if I set it, UITableView stop scrolling verticaly.
Thanks for any help!
I had same issue & same hierarchy of the views, With latest sdk , just use it :
Setting delaysContentTouches to NO for UIButton in the same UITableViewCell.
Your CustomView's frame could be interfering with your UIButton. Are they overlapping? Add your button to the CustomView just to test by
[CustomView addSubview:UIButton];
(using your values of course). If it works, then your issue is most likely an overlap.