StrongVC.m 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. //
  2. // StrongVC.m
  3. // jiaPei
  4. //
  5. // Created by apple on 16/1/13.
  6. // Copyright © 2016年 JCZ. All rights reserved.
  7. //
  8. #import "StrongVC.h"
  9. #import "StrongCell.h"
  10. #import "PicSymbolTableViewCell.h"
  11. #import "DB_Que_Helper.h"
  12. #import "symbol.h"
  13. #import "ChildSymbolVC.h"
  14. @interface StrongVC ()<UITableViewDataSource,UITableViewDelegate>
  15. {
  16. NSArray *titleArray;
  17. NSMutableArray *countArray;
  18. NSArray *titles;
  19. NSArray *counts;
  20. }
  21. /// viewModel
  22. @property (nonatomic, readonly, strong) RQStrongViewModel *viewModel;
  23. @end
  24. @implementation StrongVC
  25. @dynamic viewModel;
  26. - (void)viewDidLoad {
  27. [super viewDidLoad];
  28. //导航条颜色
  29. // [self.navigationController.navigationBar setBackgroundColor:navBarColor];
  30. // [self configNavigationBar];
  31. // [self setTitle:@"强化练习"];
  32. [self myInit];
  33. }
  34. -(void)myInit
  35. {
  36. // titleArray = @[@"时间",@"距离",@"罚款",@"速度",@"标线",@"标志",@"记分",@"选择",@"图片",@"手势",@"信号灯",@"酒驾",@"灯光",@"仪表",@"装置",@"路况",@"判断",@"动画"];
  37. // countArray = [NSMutableArray array];
  38. // titleArray = [RQ_YDTQuestion_Module getPoint];
  39. // for (int i = 0; i < 18; i ++) {
  40. //
  41. // NSString *string = titleArray[i];
  42. // myDelegate.where = [NSString stringWithFormat:@"kind = '%@' and car_type = '%@' and subject = '%@'",string,RQ_YDTQuestion_Module.car_type,myDelegate.subject];
  43. //
  44. // if (i == 7) {
  45. // myDelegate.where = [NSString stringWithFormat:@"option_type != 0 and car_type = '%@' and subject = '%@'",RQ_YDTQuestion_Module.car_type,myDelegate.subject];
  46. // }
  47. // if (i == 8) {
  48. // myDelegate.where = [NSString stringWithFormat:@"media_type = 1 and car_type = '%@' and subject = '%@'",RQ_YDTQuestion_Module.car_type,myDelegate.subject];
  49. // }
  50. // if (i == 16) {
  51. // myDelegate.where = [NSString stringWithFormat:@"option_type = 0 and car_type = '%@' and subject = '%@'",RQ_YDTQuestion_Module.car_type,myDelegate.subject];
  52. // }
  53. // if (i == 17) {
  54. // myDelegate.where = [NSString stringWithFormat:@"media_type = 2 and car_type = '%@' and subject = '%@'",RQ_YDTQuestion_Module.car_type,myDelegate.subject];
  55. // }
  56. //
  57. // if (!myDelegate.subject) {
  58. // myDelegate.where = [NSString stringWithFormat:@"kind = '%@' and car_type = '%@'",string,RQ_YDTQuestion_Module.car_type];
  59. //
  60. // if (i == 7) {
  61. // myDelegate.where = [NSString stringWithFormat:@"option_type != 0 and car_type = '%@'",RQ_YDTQuestion_Module.car_type];
  62. // }
  63. // if (i == 8) {
  64. // myDelegate.where = [NSString stringWithFormat:@"media_type = 1 and car_type = '%@'",RQ_YDTQuestion_Module.car_type];
  65. // }
  66. // if (i == 16) {
  67. // myDelegate.where = [NSString stringWithFormat:@"option_type = 0 and car_type = '%@'",RQ_YDTQuestion_Module.car_type];
  68. // }
  69. // if (i == 17) {
  70. // myDelegate.where = [NSString stringWithFormat:@"media_type = 2 and car_type = '%@'",RQ_YDTQuestion_Module.car_type];
  71. // }
  72. // }
  73. //
  74. // NSInteger count = [DB_Que_Helper countForQuery:@"strong"];
  75. // [countArray addObject:[NSString stringWithFormat:@"%ld",(long)count]];
  76. // }
  77. titles = @[@"交通标志",@"汽车仪表盘指示灯",@"新版交警手势",@"车内功能按键",@"交通事故责任认定图解",@"色盲测试图集"];
  78. counts = @[@"389",@"21",@"8",@"6",@"35",@"19"];
  79. UITableView *mainTableView = [[UITableView alloc] initWithFrame:RQ_SCREEN_BOUNDS style:UITableViewStyleGrouped];
  80. // mainTableView.height -= kNavOffSet;
  81. mainTableView.delegate = self;
  82. mainTableView.dataSource = self;
  83. mainTableView.backgroundColor = backGroundColor;
  84. mainTableView.estimatedSectionHeaderHeight = 0;
  85. [self.view addSubview:mainTableView];
  86. }
  87. #pragma mark mainTableView delegate
  88. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  89. {
  90. return 1;
  91. }
  92. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  93. {
  94. // if (section == 0)
  95. // {
  96. //// return titleArray.count/2;
  97. // NSInteger number = ceilf([RQ_YDTQuestion_Module getPoint].count / 2.f);
  98. // return number;
  99. // }
  100. // else
  101. // {
  102. return titles.count;
  103. // }
  104. }
  105. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  106. {
  107. // if (indexPath.section == 0)
  108. // {
  109. // RQYDTPointModel *ydtPointModel = [RQ_YDTQuestion_Module getPoint][indexPath.row];
  110. // NSInteger a = ceilf([RQ_YDTQuestion_Module getPoint].count / 2.f);
  111. // NSInteger b = indexPath.row + a;
  112. // RQYDTPointModel *rightYdtPointModel = b >= [RQ_YDTQuestion_Module getPoint].count? nil : [RQ_YDTQuestion_Module getPoint][indexPath.row + a];
  113. //
  114. // StrongCell *cell = [[[NSBundle mainBundle] loadNibNamed:@"StrongCell" owner:nil options:nil] firstObject];
  115. //// cell.titleLabel.text = [NSString stringWithFormat:@"%@ %@",titleArray[indexPath.row],countArray[indexPath.row]];
  116. //// cell.rightTitleLabel.text = [NSString stringWithFormat:@"%@ %@",titleArray[indexPath.row + 9],countArray[indexPath.row + 9]];
  117. //
  118. //
  119. //
  120. //// cell.rightIndexLabel.text = [NSString stringWithFormat:@"%d",(int)indexPath.row + 10];
  121. //
  122. //
  123. // if (ydtPointModel) {
  124. // cell.titleLabel.text = [NSString stringWithFormat:@"%@ %ld",ydtPointModel.name,[RQ_YDTQuestion_Module getPointQuestionWithPointID:ydtPointModel.id].count];
  125. // [cell.btn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
  126. // cell.btn.tag = indexPath.row;
  127. // cell.indexLabel.backgroundColor = [UIColor qmui_randomColor];
  128. // cell.indexLabel.text = [NSString stringWithFormat:@"%d",(int)indexPath.row + 1];
  129. // }
  130. //
  131. // if (rightYdtPointModel) {
  132. // cell.rightTitleLabel.text = [NSString stringWithFormat:@"%@ %ld",rightYdtPointModel.name,[RQ_YDTQuestion_Module getPointQuestionWithPointID:rightYdtPointModel.id].count];
  133. // [cell.rightBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
  134. // cell.rightBtn.tag = indexPath.row + a;
  135. // cell.rightIndexLabel.backgroundColor = [UIColor qmui_randomColor];
  136. // cell.rightIndexLabel.text = [NSString stringWithFormat:@"%ld",(int)indexPath.row + a + 1];
  137. // }
  138. //
  139. //// cell.rightBtn.tag = indexPath.row + 9;
  140. //
  141. //
  142. //
  143. // return cell;
  144. // }
  145. // else
  146. // {
  147. PicSymbolTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"picSymbol"];
  148. if (!cell)
  149. {
  150. cell = [[PicSymbolTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"picSymbol"];
  151. }
  152. cell.titleLable.text = titles[indexPath.row];
  153. if (indexPath.row == 0)
  154. {
  155. cell.img1.image = [UIImage imageNamed:@"1-1-1.jpg"];
  156. cell.img2.image = [UIImage imageNamed:@"1-1-2.jpg"];
  157. cell.img3.image = [UIImage imageNamed:@"1-1-3.jpg"];
  158. cell.img4.image = [UIImage imageNamed:@"1-1-4.jpg"];
  159. }
  160. else
  161. {
  162. cell.img1.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d-1%d-1.jpg",(int)indexPath.row + 1,(int)indexPath.row + 1]];
  163. cell.img2.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d-1%d-2.jpg",(int)indexPath.row + 1,(int)indexPath.row + 1]];
  164. cell.img3.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d-1%d-3.jpg",(int)indexPath.row + 1,(int)indexPath.row + 1]];
  165. cell.img4.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d-1%d-4.jpg",(int)indexPath.row + 1,(int)indexPath.row + 1]];
  166. }
  167. cell.countLabel.text = counts[indexPath.row];
  168. [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
  169. return cell;
  170. // }
  171. }
  172. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  173. {
  174. // if (indexPath.section == 0){
  175. // return 44;
  176. // }else{
  177. return kFrame.size.width/5.0 + 30;
  178. // }
  179. }
  180. -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  181. {
  182. // if (indexPath.section == 1)
  183. // {
  184. if (indexPath.row == 0)
  185. {
  186. symbol *sym = [[symbol alloc] init];
  187. [self navPushHideTabbarToVC:sym];
  188. }else{
  189. ChildSymbolVC *childSym = [[ChildSymbolVC alloc] init];
  190. childSym.rowTag = indexPath.row + 10;
  191. childSym.MI_GROUP = [NSString stringWithFormat:@"%d",(int)indexPath.row + 1];
  192. childSym.MI_TYPE = [NSString stringWithFormat:@"1%d",(int)indexPath.row + 1];
  193. [self navPushHideTabbarToVC:childSym];
  194. }
  195. // }
  196. }
  197. -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  198. {
  199. UIView * view = [[UIView alloc] init];
  200. view.backgroundColor = backGroundColor;
  201. return view;
  202. }
  203. -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  204. {
  205. // if (section == 0){
  206. // return .1;
  207. // }else{
  208. return 20;
  209. // }
  210. }
  211. -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
  212. return [UIView new];
  213. }
  214. -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
  215. {
  216. if (section == 0){
  217. return .1;
  218. }else{
  219. return .1;
  220. }
  221. }
  222. -(void)click:(UIButton *)btn
  223. {
  224. // NSString *string = titleArray[btn.tag];
  225. //
  226. // myDelegate.where = [NSString stringWithFormat:@"kind = '%@' and car_type = '%@' and subject = '%@'",string,RQ_YDTQuestion_Module.car_type,myDelegate.subject];
  227. //
  228. // if (btn.tag == 7) {
  229. // myDelegate.where = [NSString stringWithFormat:@"option_type != 0 and car_type = '%@' and subject = '%@'",RQ_YDTQuestion_Module.car_type,myDelegate.subject];
  230. // }
  231. // if (btn.tag == 8) {
  232. // myDelegate.where = [NSString stringWithFormat:@"media_type = 1 and car_type = '%@' and subject = '%@'",RQ_YDTQuestion_Module.car_type,myDelegate.subject];
  233. // }
  234. // if (btn.tag == 16) {
  235. // myDelegate.where = [NSString stringWithFormat:@"option_type = 0 and car_type = '%@' and subject = '%@'",RQ_YDTQuestion_Module.car_type,myDelegate.subject];
  236. // }
  237. // if (btn.tag == 17) {
  238. // myDelegate.where = [NSString stringWithFormat:@"media_type = 2 and car_type = '%@' and subject = '%@'",RQ_YDTQuestion_Module.car_type,myDelegate.subject];
  239. // }
  240. //
  241. // if (!myDelegate.subject) {
  242. // myDelegate.where = [NSString stringWithFormat:@"kind = '%@' and car_type = '%@'",string,RQ_YDTQuestion_Module.car_type];
  243. //
  244. // if (btn.tag == 7) {
  245. // myDelegate.where = [NSString stringWithFormat:@"option_type != 0 and car_type = '%@'",RQ_YDTQuestion_Module.car_type];
  246. // }
  247. // if (btn.tag == 8) {
  248. // myDelegate.where = [NSString stringWithFormat:@"media_type = 1 and car_type = '%@'",RQ_YDTQuestion_Module.car_type];
  249. // }
  250. // if (btn.tag == 16) {
  251. // myDelegate.where = [NSString stringWithFormat:@"option_type = 0 and car_type = '%@'",RQ_YDTQuestion_Module.car_type];
  252. // }
  253. // if (btn.tag == 17) {
  254. // myDelegate.where = [NSString stringWithFormat:@"media_type = 2 and car_type = '%@'",RQ_YDTQuestion_Module.car_type];
  255. // }
  256. // }
  257. }
  258. - (void)didReceiveMemoryWarning {
  259. [super didReceiveMemoryWarning];
  260. }
  261. /*
  262. #pragma mark - Navigation
  263. // In a storyboard-based application, you will often want to do a little preparation before navigation
  264. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  265. // Get the new view controller using [segue destinationViewController].
  266. // Pass the selected object to the new view controller.
  267. }
  268. */
  269. @end