Custom UiableViewcell с кнопкой

Я подклассул UiableViewCell и добавил к нему кнопку. Как я отвечу на событие, когда кнопка затрагивается? Мне также нужно знать, какой путь индекса был нажатой кнопке.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"CustomTableCell";

    CustomTableCell *cell = (CustomTableCell *)
    [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        NSArray *topLevelObjects = [[NSBundle mainBundle]
                                    loadNibNamed:@"CustomTableCell"
                                    owner:nil options:nil];
        for (id currentObjects in topLevelObjects){
            if ([currentObjects isKindOfClass:[StatusTableCell class]]){
                cell = (StatusTableCell *) currentObjects;
                break;
            }
        }                           
    }
    cell.customButton.tag = indexPath.row;
    return cell;
}
0
задан John2 19 September 2011 в 03:02
поделиться