Advertisement
Guest User

Untitled

a guest
Sep 16th, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  2.  
  3. M13Checkbox *CheckBox = nil;
  4. UILabel *QuestionLbl = nil;
  5.  
  6. static NSString *CellIdentifier = @"Cell";
  7. UITableViewCell *cell =(UITableViewCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  8. if (cell == nil) {
  9. cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
  10.  
  11. CheckBox = [[M13Checkbox alloc] initWithFrame:CGRectMake(9,7,26,26)];
  12. CheckBox.tag = 1000;
  13.  
  14. [CheckBox addTarget:self action:@selector(CheckBoxSelected:) forControlEvents:UIControlEventValueChanged];
  15. [cell.contentView addSubview:CheckBox];
  16.  
  17. QuestionLbl = [[UILabel alloc] initWithFrame:CGRectMake(40,0,280,40)];
  18. [cell.contentView addSubview:QuestionLbl];
  19. QuestionLbl.tag = 2000;
  20. QuestionLbl.textColor = TopTintColor;
  21. QuestionLbl.font = kAppFontWithSize(13);
  22. QuestionLbl.numberOfLines = 2;
  23.  
  24. }else
  25. {
  26. CheckBox = (M13Checkbox *) [cell.contentView viewWithTag:1000];
  27. QuestionLbl = (UILabel *) [cell.contentView viewWithTag:2000];
  28. }
  29.  
  30. ClsSymptom *SymptomObj = nil;
  31.  
  32. switch (indexPath.section) {
  33. case 0:
  34. {
  35. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  36. SymptomObj = (ClsSymptom *)[_FirstSecArr objectAtIndex:indexPath.row];
  37. CheckBox.enabled = YES;
  38. }
  39. break;
  40. case 1:
  41. {
  42.  
  43. SymptomObj =(ClsSymptom *) [_SecondSecArr objectAtIndex:indexPath.row];
  44. if ([SymptomObj.Name isEqualToString:AddSymptomText])
  45. {
  46. CheckBox.enabled = NO;
  47. cell.selectionStyle = UITableViewCellSelectionStyleGray;
  48. }else
  49. {
  50. CheckBox.enabled = YES;
  51. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  52. }
  53.  
  54. }
  55. break;
  56. case 2:
  57. {
  58.  
  59. SymptomObj =(ClsSymptom *) [_ThirdSecArr objectAtIndex:indexPath.row];
  60. QuestionLbl.text = SymptomObj.Name;
  61. cell.selectionStyle = UITableViewCellSelectionStyleGray;
  62. CheckBox.enabled = YES;
  63.  
  64. }
  65. break;
  66. case 3:
  67. {
  68. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  69. // SymptomObj = [_FourthSecArr objectAtIndex:indexPath.row];
  70. CheckBox.enabled = YES;
  71.  
  72. }
  73. break;
  74. default:
  75. break;
  76. }
  77. if(indexPath.section==3)
  78. {
  79. if (indexPath.row==0)
  80. {
  81. QuestionLbl.text = @"Yes";
  82. [CheckBox setCheckState:TreatmentSelected];
  83. }
  84. else
  85. {
  86. QuestionLbl.text = @"No";
  87. [CheckBox setCheckState:NoTreatmentSelected];
  88. }
  89. }else{
  90. QuestionLbl.text = SymptomObj.Name;
  91. [CheckBox setCheckState:SymptomObj.isSelected];
  92. }
  93. return cell;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement