Guest User

Untitled

a guest
Jan 16th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. QuestionCell *qc = (QuestionCell*)[questionsTable cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
  2. NSLog(@"qc %@",qc); // Gives "qc (NULL)" if there's text in the custom cell
  3.  
  4. #import <UIKit/UIKit.h>
  5.  
  6. @interface QuestionCell : UITableViewCell
  7.  
  8.  
  9. @property (weak, nonatomic) IBOutlet UILabel *correctionLabel;
  10. @property (weak, nonatomic) IBOutlet UIImageView *correctionMark;
  11. @property (weak, nonatomic) IBOutlet UILabel *pronounLabel;
  12. @property (weak, nonatomic) IBOutlet UITextField *answerInput;
  13.  
  14. @end
  15.  
  16. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  17. if (indexPath.section == 0)
  18. {
  19. QuestionCell *cell = nil;
  20. cell = [tableView dequeueReusableCellWithIdentifier:@"QuestionCell"];
  21.  
  22. NSString *pronoun = nil;
  23.  
  24. switch (indexPath.row) {
  25. case 0:
  26. pronoun = @"je";
  27. break;
  28. case 1:
  29. pronoun = @"tu";
  30. break;
  31. case 2:
  32. pronoun = @"il";
  33. break;
  34. case 3:
  35. pronoun = @"nous";
  36. break;
  37. case 4:
  38. pronoun = @"vous";
  39. break;
  40. case 5:
  41. pronoun = @"ils";
  42. break;
  43. default:
  44. break;
  45. }
  46.  
  47. cell.pronounLabel.text = pronoun;
  48.  
  49. return cell;
  50. }
  51. if (indexPath.section == 1)
  52. {
  53. ActionCell *cell = nil;
  54. cell = [tableView dequeueReusableCellWithIdentifier:@"ActionCell"];
  55. return cell;
  56. }
  57. return nil;
  58. }
Add Comment
Please, Sign In to add comment