RecordList.m 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. #import "RecordList.h"
  2. #import "CLCell.h"
  3. #import "PostTopicVC.h"
  4. @interface RecordList ()<UITableViewDataSource,UITableViewDelegate>
  5. {
  6. NSArray* titles,*tint;
  7. }
  8. @end
  9. @implementation RecordList
  10. - (void)viewDidLoad {
  11. [super viewDidLoad];
  12. [self myInit];
  13. }
  14. - (void)didReceiveMemoryWarning {
  15. [super didReceiveMemoryWarning];
  16. }
  17. #pragma mark -
  18. -(void)myInit
  19. {
  20. [self configNavigationBar];
  21. [self.view setBackgroundColor:[UIColor whiteColor]];
  22. [self setTitle:@"我要记录"];
  23. UITableView* tv = [[UITableView alloc] initWithFrame:kFrame];
  24. tv.height -= kNavOffSet;
  25. [tv setDelegate:self];
  26. [tv setDataSource:self];
  27. [self.view addSubview:tv];
  28. tv.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
  29. UILabel* label = [[UILabel alloc ] initWithFrame:CGRectMake(0, 0, kSize.width, 40)];
  30. [label setTextAlignment:NSTextAlignmentCenter];
  31. [label setText:@"记下今天做了什么" ];
  32. [label setFont:[UIFont scaleSize:NormalFont]];
  33. [label setTextColor:subTitleColor];
  34. CGFloat x = kSize.width/2.0 - [label.text sizeForFont:NormalFont].width/2.0 - 30;
  35. UIImageView* iv = [[UIImageView alloc] initWithFrame:CGRectMake(x, 10, 20, 20)];
  36. [iv setImage:[UIImage imageNamed:@"img03pen.png"] ];
  37. [label addSubview:iv];
  38. [label addSelfViewWithRect:CGRectMake(0, 39, kSize.width, 1) Color:KlineColor];
  39. tv.tableHeaderView = label;
  40. titles = @[@"科目一法规培训",@"科目一考试",@"科目二场地练习",@"科目二考试",@"科目三实路练习",
  41. @"科目三考试",@"科目四考试",@"拿驾照啦"];
  42. tint = @[@"",@"",@"",@"",
  43. defGreen,[UIColor redColor],@"",@"",];
  44. }
  45. -(UIImage*)imageAtRow:(NSInteger)row
  46. {
  47. UIImage * image;
  48. NSArray* arr = @[@"subject1_title_press.png",@"guide_icon1.png",@"subject2_title_press.png",@"guide_icon2.png",
  49. @"guide_icon3.png",@"guide_icon6.png",@"guide_icon4.png",@"subject4_title_press.png"];
  50. image = [UIImage imageNamed:arr[row]];
  51. if ( 4 == row) {
  52. image = [image tint:defGreen];
  53. }
  54. if (5 == row) {
  55. image = [image tint:[UIColor redColor]];
  56. }
  57. return image;;
  58. }
  59. #pragma mark -
  60. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  61. {
  62. return titles.count;
  63. }
  64. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  65. {
  66. CLCell* cell = [CLCell cellForTableView:tableView Style:UITableViewCellStyleDefault];
  67. [cell.textLabel setText:titles[indexPath.row]];
  68. [cell.imageView setImage:[self imageAtRow:indexPath.row]];
  69. [cell.textLabel setTextColor:contentTextColor];
  70. [cell.textLabel setFont:[UIFont scaleSize:13]];
  71. return cell;
  72. }
  73. -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  74. {
  75. PostTopicVC* vc = [PostTopicVC new];
  76. vc.type = @"2";
  77. if (indexPath.row < 2)
  78. {
  79. vc.childID = @"1";
  80. }
  81. else if (indexPath.row < 4)
  82. {
  83. vc.childID = @"2";
  84. }
  85. else if (indexPath.row < 6)
  86. {
  87. vc.childID = @"3";
  88. }
  89. else if (indexPath.row < 7)
  90. {
  91. vc.childID = @"5";
  92. }
  93. else
  94. {
  95. vc.childID = @"6";
  96. }
  97. NSString* str = [NSString stringWithFormat:@"%d",(int)indexPath.row+10];
  98. // NSLog(@"groupId->%@",str);
  99. vc.groupId = str;
  100. [self navPushHideTabbarToVC:vc];
  101. }
  102. @end