Guest User

Untitled

a guest
Jun 19th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. // Return a cell for the ith row
  2. - (UITableViewCell *)tableView:(UITableView *)tView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  3. {
  4. int section = [indexPath section]; // Set up the cell
  5. DataManagment *myManager = [DataManagment sharedDataManager];
  6. NSArray *streams = myManager.results;
  7. NSDictionary *stream = (NSDictionary *)[streams objectAtIndex:(int) row_selected];
  8. //regular cell
  9. NSString *CellIdentifier = @"CustomCellDetailView";
  10. CustomCellDetailView *cell = (CustomCellDetailView *) [table dequeueReusableCellWithIdentifier:CellIdentifier];
  11. if (cell == nil) {
  12.  
  13. NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomCellDetailView" owner:self options:nil];
  14.  
  15. for (id currentObject in topLevelObjects){
  16. if ([currentObject isKindOfClass:[UITableViewCell class]]){
  17. cell = (CustomCellDetailView *) currentObject;
  18. break;
  19. }
  20. }
  21. } //adress cell
  22. NSString *CellIdentifier1 = @"CustomCellAdress";
  23. CustomCellAdress *cell1 = (CustomCellAdress *) [table dequeueReusableCellWithIdentifier:CellIdentifier1];
  24. if (cell1 == nil) {
  25.  
  26. NSArray *topLevelObjects1 = [[NSBundle mainBundle] loadNibNamed:@"CustomCellAdress" owner:self options:nil];
  27.  
  28. for (id currentObject1 in topLevelObjects1){
  29. if ([currentObject1 isKindOfClass:[UITableViewCell class]]){
  30. cell1 = (CustomCellAdress *) currentObject1;
  31. break;
  32. }
  33. }
  34. }
  35. switch (section) {
  36. //first section
  37. case 0:
  38. cell.backgroundColor = [UIColor whiteColor];
  39. [cell.title setText:@"Phone"];
  40. [cell.content setText:[stream valueForKey:@"phone"]];
  41. return cell;
  42. break;
  43. //second section
  44. case 1:
  45. cell1.backgroundColor = [UIColor whiteColor];
  46. [cell1.line1 setText:@"Phone"];
  47. [cell1.line2 setText:[stream valueForKey:@"phone"]];
  48. return cell1;
  49. break;
  50. //third section
  51. case 2:
  52. cell.backgroundColor = [UIColor whiteColor];
  53. [cell.title setText:@"Distance"];
  54. [cell.content setText:[stream valueForKey:@"distance"]];
  55. return cell;
  56. break;
  57. }
  58.  
  59. }
Add Comment
Please, Sign In to add comment