How to disable UserInteraction for UITableview cell but not in custom button on that  cell..
I am creating a button using :
    UIButton *dayButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [dayButton setFrame:CGRectMake(201, 0, 30, 35)];
    [dayButton addTarget:self action:@selector(selectDayView) forControlEvents:UIControlEventTouchUpInside];
    [dayButton setBackgroundImage:[UIImage imageNamed:@"86-camera.png"] forState:UIControlStateNormal];
    dayButton.userInteractionEnabled=YES;
    [cell addSubview:dayButton];
and then I set
    cell.userInteractionEnabled=NO;
how can I get dayButtonAction ?
Don't disable user interaction with the whole cell. Set cell.selectionStyle = UITableViewCellSelectionStyleNone to prevent the cell selection. That way the user can still interact with the button.
If you set the cell.userinteraction = NO then you can't touch the button because any interaction is closed for the cell and it's subviews.
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