Custom buttons in XIB used as Custom UITableViewCell don't respond to taps (ios7)

So here I am upgrading a working ios6 app to ios7, and now I can’t receive taps or other actions on custom buttons (or other subviews) inside my tableviewcells.


  • How to create an IPA on XCode 4.3.2
  • Converting a gregorian date string to Islamic date gives correct & incorrect results
  • How to Resize image in Swift?
  • why is audio coming up garbled when using AVAssetReader with audio queue
  • Near Real Time Video Upload from iPhone
  • How to auto generate NSManagedObject subclasses with date attribute as Date instead of NSDate?
  • My code:

    Here is where I deploy my PlaceCell

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        static NSString *cellIdentifier = @"PlaceCell";
        PlaceCell *cell = [tableView dequeueReusableCellWithIdentifier: cellIdentifier];
        if (!cell) {
            NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"PlaceCell" owner:self options:nil];
            cell = [nib lastObject];
            cell.reuseIdentifier = cellIdentifier;
        [cell configureCellWithPlace: [self.places objectAtIndex:indexPath.row]];
        cell.delegate = self;
        cell.userInteractionEnabled = YES;
        return cell;

    And then it is a normal custom cell with buttons which are connected to some actions by the interface.
    It works perfectly with iOS6, but it does nothing with iOS7.

    Thank you for your help.

    5 Solutions Collect From Internet About “Custom buttons in XIB used as Custom UITableViewCell don't respond to taps (ios7)”

    Solved with:

    [cell.contentView setUserInteractionEnabled: NO];

    This happens when your Cell’s view in xib file is not a UITableViewCell, but only a UIView. Make sure that that the xib’s top view is a UITableViewCell.

    You can easily check it by looking into the first child of the main view inside the interface builder. If the first subview is not “Content View” then you should rebuild the cell with UITableViewCell on the top.

    Also make sure that button is a subview of the “Content View”.

    Put your button into cell’s contentView.

    I had a similar problem. I had dragged a UIView into the xib to use as my UITableViewCell. Even though I changed the classname to a subclass of a UITableViewCell in Interface Builder, the events on my buttons still didn’t fire. Since it was originally a UIView, IB never knew about contentView and didn’t add my controls to it.

    Dragging a “real” UITableViewCell into the xib, changing its class to the one I wanted, and then rewiring up the IBOutlets fixed everything. Didn’t need to mess with delaysContentTouches or other properties either.

    Moral of the story: drag the right thing onto your xibs.

    It seems to be that when you use interface builder to customize a cell subclass all the views added are added below the contentView. This is why setting userInteractionEnabled = NO on the content view works, because touch events are allow to pass through.

    I used po [view recursiveDescription] with lldb to determine this.