Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
67
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.     if (indexPath.section == 0) {
  4.        
  5.         if (indexPath.row == 0) {
  6.            
  7.             ActionDetailTopTableViewCell *cell = (ActionDetailTopTableViewCell *)[tableView dequeueReusableCellWithIdentifier: kActionDetailTopTableViewCell forIndexPath:indexPath];
  8.             [cell initWithAction:self.action andGroup:self.group];
  9.             cell.delegate = self;
  10.             cell.selectionStyle = UITableViewCellSelectionStyleNone;
  11.             return cell;
  12.         }
  13.         else if (indexPath.row == 1 || indexPath.row == 2 || indexPath.row == 3){
  14.            
  15.             ActionDetailMenuItemTableViewCell *cell = (ActionDetailMenuItemTableViewCell *)[tableView dequeueReusableCellWithIdentifier: kActionDetailMenuItemTableViewCell forIndexPath:indexPath];
  16.             cell.itemTitle.numberOfLines = 0;
  17.             cell.itemTitle.delegate = self;
  18.             if (self.indexPathRowToExpand == indexPath.row) {
  19.                
  20.                 cell.openCloseMenuItemImageView.image = [UIImage imageNamed:@"Minus"];
  21.                 if (indexPath.row == 1) {
  22.                     cell.itemTitle.text = self.action.body;
  23.                 }
  24.                 else if (indexPath.row == 2) {
  25.                     cell.itemTitle.text = self.action.script;
  26.                 }
  27.             }
  28.             else {
  29.                 if (indexPath.row == 3) {
  30.                     cell.openCloseMenuItemImageView.image = [UIImage imageNamed:@"shareIcon"];
  31.                 }
  32.                 else {
  33.                     cell.openCloseMenuItemImageView.image = [UIImage imageNamed:@"AddGroup"];
  34.                 }
  35.                 cell.itemTitle.text = self.listOfMenuItems[indexPath.row-1];
  36.             }
  37.             return cell;
  38.         }
  39.         else  {
  40.             UITableViewCell *cell =  [tableView dequeueReusableCellWithIdentifier:@"cell"];
  41.             if (!cell) {
  42.                 cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
  43.                 cell.textLabel.font = [UIFont voicesBoldFontWithSize:21];
  44.                 cell.textLabel.text = @"Contact Reps";
  45.                 cell.textLabel.textAlignment = NSTextAlignmentCenter;
  46.                 cell.selectionStyle = UITableViewCellSelectionStyleNone;
  47.             }
  48.             return cell;
  49.         }
  50.     }
  51.     else if (indexPath.section == 1) {
  52.        
  53.         if (self.listOfReps.count) {
  54.             RepTableViewCell *cell = (RepTableViewCell *)[tableView dequeueReusableCellWithIdentifier:kRepTableViewCell forIndexPath:indexPath];
  55.             [cell initWithRep:self.listOfReps[indexPath.row - 5]];
  56.             return cell;
  57.         }
  58.         else {
  59.             ActionDetailEmptyRepTableViewCell *cell = (ActionDetailEmptyRepTableViewCell *)[tableView dequeueReusableCellWithIdentifier: kActionDetailEmptyRepTableViewCell forIndexPath:indexPath];
  60.             cell.selectionStyle = UITableViewCellSelectionStyleNone;
  61.            
  62.             return cell;
  63.         }
  64.     }
  65.     else {
  66.         ActionDetailFooterTableViewCell *footerCell = (ActionDetailFooterTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"ActionDetailFooterTableViewCell" forIndexPath:indexPath];
  67.         return footerCell;
  68.     }
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement