The above image is UITableViewCell designer preview. Button (Refer 1) touch up inside event is working properly.
But, Button (Refer 2) touch up inside event not triggering. It is inside a view.
I disabled the UserInteractionEnabled property of Button(Refer 2)'s View.
But, No luck. Not working.
your View height is 0 that's why you not able to tap it
to test it set clips to bound value to yes
and also you need to set height for your view to solve that issue
1) In your cellForRowAtIndexPath: method, assign button tag as index:
cell.yourbutton.tag = indexPath.row;
2) Add target and action for your button as below:
[cell.yourbutton addTarget:self action:@selector(yourButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
3) Code actions based on index as below in ViewControler:
-(void)yourButtonClicked:(UIButton*)sender
{
if (sender.tag == 0)
{
// Your code here
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With