iphoneobjective-cuitableview

how to disable UserInteraction for UITableview cell but not in custom button on cell


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 ?


Solution

  • It is not possible to applies disable userInteraction for UITableView and not on UITableViewCell. You can access content/controllers of UITableVie (which is sub View of UITableView) when userInteraction is enable of UITabelView. When you add any controller on UITableView actually you added it on UITableViewCell but cell is part of UITableView so when you disable userInteraction on UITableView it means it aslo set it(NO) for UITableViewCell.

    And Here i aslo give you suggestion for add your UIButton to cell as a

    [cell.contentView addSubView:buttonName];