2010-07-01 2 views

Répondre

2

Si vous avez les délégués de table mis en place correctement (voir tutoriel d'Apple AdvancedTableViewCells ou un certain nombre de bons tutoriels là-bas pour plus d'informations), vous suivez le protocole d'Apple en mettant en œuvre cette méthode:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 

    // in here you can do stuff based on which cell they selected 
    // at a certain index path, like the examples below 

    // get value for which row was pressed 
    int row = indexPath.row; 

    // or find cell that was just pressed and grab handle for the new info that needs to be put on it 
    UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath]; 
    UIButton *newButton; 
    newButton = (UIButton *)[cell viewWithTag:4]; 

    UILabel *newLabel; 
    newLabel = (UILabel *)[cell viewWithTag:5]; 

    // or de-select the row per Apple's Human Interface Guidelines 
    [tableView deselectRowAtIndexPath:indexPath animated:YES]; 

} 

Ce sont juste des exemples génériques, mais j'espère qu'ils éclaircissent un peu le sujet pour vous!

+0

parfait, merci beaucoup. – jarryd

Questions connexes