Advertisement
RRK

Select Row

RRK
Aug 22nd, 2013
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  2. {
  3.     static NSString *CellIdentifier = @"Cell";
  4.    
  5.     CustomCell *tableCell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  6.    
  7.     if (tableCell == nil)
  8.     {
  9.         NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
  10.         tableCell = [nib objectAtIndex:0];
  11.     }
  12.    
  13.     // Configure the cell...
  14.  
  15.    
  16.    
  17.     [tableCell.backgroundImage setBackgroundImage:.....]
  18.    
  19.     return tableCell;
  20. }
  21.  
  22. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  23. {    
  24.     NSLog(@"%@",m_indexPath);
  25.     CustomCell *previouslySelectedCell = (CustomCell*)[tableView cellForRowAtIndexPath:m_indexPath];
  26.     [previouslySelectedCell.backgroundImage setImage:nil];
  27.     [tableView deselectRowAtIndexPath:m_indexPath animated:YES];
  28.    
  29.        
  30.     CustomCell * cell = (CustomCell* )[tableView cellForRowAtIndexPath:indexPath];
  31.     NSLog(cell.selectionStatus ? @"Yes" : @"No");
  32.    
  33.     [cell.backgroundImage setImage:.......];
  34.    
  35.      m_indexPath = indexPath;
  36.    
  37. }
  38.  
  39. - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
  40. {
  41.     CustomCell * cell = (CustomCell* )[tableView cellForRowAtIndexPath:indexPath];
  42.    
  43.     [cell.backgroundImage setImage:nil];
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement