Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. //cell for row at indexpath
  2. ----------------------------------------
  3.  
  4. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  5. {
  6.  
  7. static NSString *CellIdentifier = @"CellIdentifier";
  8.  
  9. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  10.  
  11. if (!cell) {
  12.  
  13. cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
  14.  
  15.  
  16. cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
  17. }
  18.  
  19.  
  20. UILabel*titleUIL=(UILabel *) [cell.contentView viewWithTag:1];
  21.  
  22. UILabel*no=(UILabel *) [cell.contentView viewWithTag:10];
  23.  
  24. UILabel*numLab=(UILabel *) [cell.contentView viewWithTag:22];
  25.  
  26. UITextView *txt=(UITextView *)[cell.contentView viewWithTag:21];
  27.  
  28. txt.delegate = self;
  29.  
  30. titleUIL.text = [[dicc valueForKey:[headersArray objectAtIndex:indexPath.section]]objectAtIndex:indexPath.row];
  31.  
  32. UIButton *notappBTN=(UIButton *)[cell.contentView viewWithTag:112];
  33.  
  34. UIButton *yesBTN=(UIButton *)[cell.contentView viewWithTag:100];
  35.  
  36. UIButton *NOBTN=(UIButton *)[cell.contentView viewWithTag:111];
  37.  
  38.  
  39. // [yesBTN setBackgroundColor:[UIColor whiteColor]];
  40. //
  41. // [NOBTN setBackgroundColor:[UIColor redColor]];
  42. //
  43. // [notappBTN setBackgroundColor:[UIColor whiteColor]];
  44.  
  45. NSInteger sectionCount =0;
  46.  
  47. if (indexPath.section != 0)
  48. {
  49.  
  50. for (int q =0; q< indexPath.section; q++) {
  51.  
  52. sectionCount =sectionCount+[[dicc valueForKey:[headersArray objectAtIndex:q]]count];
  53. }
  54.  
  55. sectionCount =sectionCount + indexPath.row;
  56.  
  57. }
  58. else{
  59. sectionCount =sectionCount + indexPath.row;
  60. }
  61.  
  62. if ([answersARRAY[sectionCount] isEqualToString:@"1"]) {
  63.  
  64.  
  65. [yesBTN setBackgroundColor:[UIColor colorWithRed:0.23 green:0.62 blue:0.23 alpha:1.0]];
  66.  
  67. [NOBTN setBackgroundColor:[UIColor whiteColor]];
  68.  
  69. [notappBTN setBackgroundColor:[UIColor whiteColor]];
  70.  
  71. }
  72.  
  73.  
  74. else if ([answersARRAY[sectionCount] isEqualToString:@"-1"])
  75. {
  76.  
  77. [NOBTN setBackgroundColor:[UIColor colorWithRed:1.00 green:0.02 blue:0.02 alpha:1.0]];
  78.  
  79. [yesBTN setBackgroundColor:[UIColor whiteColor]];
  80.  
  81. [notappBTN setBackgroundColor:[UIColor whiteColor]];
  82.  
  83.  
  84. }
  85. else if ([answersARRAY[sectionCount] isEqualToString:@"0"]){
  86.  
  87. [NOBTN setBackgroundColor:[UIColor whiteColor]];
  88.  
  89. [notappBTN setBackgroundColor:[UIColor colorWithRed:0.97 green:0.56 blue:0.02 alpha:1.0]];
  90.  
  91. [yesBTN setBackgroundColor:[UIColor whiteColor]];
  92.  
  93.  
  94. }
  95.  
  96. numLab.text= [NSString stringWithFormat:@"%i",indexPath.row +1];
  97. return cell;
  98.  
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement