Adding target/action for custom UITableViewCell
<p>So I can't figure out what I'm doing wrong.  I have two cells, each in their own section.  Both have a UISegmentedControl in them with their own outlet/xib, etc.  Both rows show up fine in the simulator, but only the first cell (SortByTableViewCell) will have the action called when the UISegmentedControl is pressed.  In the second cell, the UISegmentedControl does not crash the app, but it also does not call its selector.  Is there something obvious that I am missing?  Thanks!</p>

<pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    NSUInteger section = [indexPath section];
    NSUInteger row = [indexPath row];
    if (section == 0) {
        static NSString *SortByCellIdentifier = @"SortByCellIdentifier";
        SortByTableViewCell *cell = (SortByTableViewCell *)[tableView dequeueReusableCellWithIdentifier:SortByCellIdentifier];
        [cell.SortBySegmentedControl addTarget:self action:@selector(SortBySegmentedControlPressed:) forControlEvents:UIControlEventValueChanged];
        if (cell == nil) {
            NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"SortByTableViewCell" owner:self options:nil];
            for (id currentObject in nibObjects) {
                if ([currentObject isKindOfClass:[SortByTableViewCell class]]) {
                    cell = (SortByTableViewCell *)currentObject;
                }
            }
        }
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        return cell;
    }
    else {

            static NSString *ConditionCellIdentifier = @"ConditionCellIdentifier";
            ConditionTableViewCell *cell = (ConditionTableViewCell *)[tableView dequeueReusableCellWithIdentifier:ConditionCellIdentifier];
            [cell.ConditionSegmentedControl addTarget:self action:@selector(ConditionSegmentedControlPressed:) forControlEvents:
             UIControlEventValueChanged];
            if (cell == nil) {
                NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"ConditionTableViewCell" owner:self options:nil];
                for (id currentObject in nibObjects) {
                    if ([currentObject isKindOfClass:[ConditionTableViewCell class]]) {
                        cell = (ConditionTableViewCell *)currentObject;
                    }
                }
            }
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        return cell;
       }
</code></pre>
