// // StrongVC.m // jiaPei // // Created by apple on 16/1/13. // Copyright © 2016年 JCZ. All rights reserved. // #import "StrongVC.h" #import "StrongCell.h" #import "PicSymbolTableViewCell.h" #import "DB_Que_Helper.h" #import "symbol.h" #import "ChildSymbolVC.h" @interface StrongVC () { NSArray *titleArray; NSMutableArray *countArray; NSArray *titles; NSArray *counts; } /// viewModel @property (nonatomic, readonly, strong) RQStrongViewModel *viewModel; @end @implementation StrongVC @dynamic viewModel; - (void)viewDidLoad { [super viewDidLoad]; //导航条颜色 // [self.navigationController.navigationBar setBackgroundColor:navBarColor]; // [self configNavigationBar]; // [self setTitle:@"强化练习"]; [self myInit]; } -(void)myInit { // titleArray = @[@"时间",@"距离",@"罚款",@"速度",@"标线",@"标志",@"记分",@"选择",@"图片",@"手势",@"信号灯",@"酒驾",@"灯光",@"仪表",@"装置",@"路况",@"判断",@"动画"]; // countArray = [NSMutableArray array]; // titleArray = [RQ_YDTQuestion_Module getPoint]; // for (int i = 0; i < 18; i ++) { // // NSString *string = titleArray[i]; // myDelegate.where = [NSString stringWithFormat:@"kind = '%@' and car_type = '%@' and subject = '%@'",string,RQ_YDTQuestion_Module.car_type,myDelegate.subject]; // // if (i == 7) { // myDelegate.where = [NSString stringWithFormat:@"option_type != 0 and car_type = '%@' and subject = '%@'",RQ_YDTQuestion_Module.car_type,myDelegate.subject]; // } // if (i == 8) { // myDelegate.where = [NSString stringWithFormat:@"media_type = 1 and car_type = '%@' and subject = '%@'",RQ_YDTQuestion_Module.car_type,myDelegate.subject]; // } // if (i == 16) { // myDelegate.where = [NSString stringWithFormat:@"option_type = 0 and car_type = '%@' and subject = '%@'",RQ_YDTQuestion_Module.car_type,myDelegate.subject]; // } // if (i == 17) { // myDelegate.where = [NSString stringWithFormat:@"media_type = 2 and car_type = '%@' and subject = '%@'",RQ_YDTQuestion_Module.car_type,myDelegate.subject]; // } // // if (!myDelegate.subject) { // myDelegate.where = [NSString stringWithFormat:@"kind = '%@' and car_type = '%@'",string,RQ_YDTQuestion_Module.car_type]; // // if (i == 7) { // myDelegate.where = [NSString stringWithFormat:@"option_type != 0 and car_type = '%@'",RQ_YDTQuestion_Module.car_type]; // } // if (i == 8) { // myDelegate.where = [NSString stringWithFormat:@"media_type = 1 and car_type = '%@'",RQ_YDTQuestion_Module.car_type]; // } // if (i == 16) { // myDelegate.where = [NSString stringWithFormat:@"option_type = 0 and car_type = '%@'",RQ_YDTQuestion_Module.car_type]; // } // if (i == 17) { // myDelegate.where = [NSString stringWithFormat:@"media_type = 2 and car_type = '%@'",RQ_YDTQuestion_Module.car_type]; // } // } // // NSInteger count = [DB_Que_Helper countForQuery:@"strong"]; // [countArray addObject:[NSString stringWithFormat:@"%ld",(long)count]]; // } titles = @[@"交通标志",@"汽车仪表盘指示灯",@"新版交警手势",@"车内功能按键",@"交通事故责任认定图解",@"色盲测试图集"]; counts = @[@"389",@"21",@"8",@"6",@"35",@"19"]; UITableView *mainTableView = [[UITableView alloc] initWithFrame:RQ_SCREEN_BOUNDS style:UITableViewStyleGrouped]; // mainTableView.height -= kNavOffSet; mainTableView.delegate = self; mainTableView.dataSource = self; mainTableView.backgroundColor = backGroundColor; mainTableView.estimatedSectionHeaderHeight = 0; [self.view addSubview:mainTableView]; } #pragma mark mainTableView delegate -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // if (section == 0) // { //// return titleArray.count/2; // NSInteger number = ceilf([RQ_YDTQuestion_Module getPoint].count / 2.f); // return number; // } // else // { return titles.count; // } } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // if (indexPath.section == 0) // { // RQYDTPointModel *ydtPointModel = [RQ_YDTQuestion_Module getPoint][indexPath.row]; // NSInteger a = ceilf([RQ_YDTQuestion_Module getPoint].count / 2.f); // NSInteger b = indexPath.row + a; // RQYDTPointModel *rightYdtPointModel = b >= [RQ_YDTQuestion_Module getPoint].count? nil : [RQ_YDTQuestion_Module getPoint][indexPath.row + a]; // // StrongCell *cell = [[[NSBundle mainBundle] loadNibNamed:@"StrongCell" owner:nil options:nil] firstObject]; //// cell.titleLabel.text = [NSString stringWithFormat:@"%@ %@",titleArray[indexPath.row],countArray[indexPath.row]]; //// cell.rightTitleLabel.text = [NSString stringWithFormat:@"%@ %@",titleArray[indexPath.row + 9],countArray[indexPath.row + 9]]; // // // //// cell.rightIndexLabel.text = [NSString stringWithFormat:@"%d",(int)indexPath.row + 10]; // // // if (ydtPointModel) { // cell.titleLabel.text = [NSString stringWithFormat:@"%@ %ld",ydtPointModel.name,[RQ_YDTQuestion_Module getPointQuestionWithPointID:ydtPointModel.id].count]; // [cell.btn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside]; // cell.btn.tag = indexPath.row; // cell.indexLabel.backgroundColor = [UIColor qmui_randomColor]; // cell.indexLabel.text = [NSString stringWithFormat:@"%d",(int)indexPath.row + 1]; // } // // if (rightYdtPointModel) { // cell.rightTitleLabel.text = [NSString stringWithFormat:@"%@ %ld",rightYdtPointModel.name,[RQ_YDTQuestion_Module getPointQuestionWithPointID:rightYdtPointModel.id].count]; // [cell.rightBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside]; // cell.rightBtn.tag = indexPath.row + a; // cell.rightIndexLabel.backgroundColor = [UIColor qmui_randomColor]; // cell.rightIndexLabel.text = [NSString stringWithFormat:@"%ld",(int)indexPath.row + a + 1]; // } // //// cell.rightBtn.tag = indexPath.row + 9; // // // // return cell; // } // else // { PicSymbolTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"picSymbol"]; if (!cell) { cell = [[PicSymbolTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"picSymbol"]; } cell.titleLable.text = titles[indexPath.row]; if (indexPath.row == 0) { cell.img1.image = [UIImage imageNamed:@"1-1-1.jpg"]; cell.img2.image = [UIImage imageNamed:@"1-1-2.jpg"]; cell.img3.image = [UIImage imageNamed:@"1-1-3.jpg"]; cell.img4.image = [UIImage imageNamed:@"1-1-4.jpg"]; } else { cell.img1.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d-1%d-1.jpg",(int)indexPath.row + 1,(int)indexPath.row + 1]]; cell.img2.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d-1%d-2.jpg",(int)indexPath.row + 1,(int)indexPath.row + 1]]; cell.img3.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d-1%d-3.jpg",(int)indexPath.row + 1,(int)indexPath.row + 1]]; cell.img4.image = [UIImage imageNamed:[NSString stringWithFormat:@"%d-1%d-4.jpg",(int)indexPath.row + 1,(int)indexPath.row + 1]]; } cell.countLabel.text = counts[indexPath.row]; [cell setSelectionStyle:UITableViewCellSelectionStyleNone]; return cell; // } } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { // if (indexPath.section == 0){ // return 44; // }else{ return kFrame.size.width/5.0 + 30; // } } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // if (indexPath.section == 1) // { if (indexPath.row == 0) { symbol *sym = [[symbol alloc] init]; [self navPushHideTabbarToVC:sym]; }else{ ChildSymbolVC *childSym = [[ChildSymbolVC alloc] init]; childSym.rowTag = indexPath.row + 10; childSym.MI_GROUP = [NSString stringWithFormat:@"%d",(int)indexPath.row + 1]; childSym.MI_TYPE = [NSString stringWithFormat:@"1%d",(int)indexPath.row + 1]; [self navPushHideTabbarToVC:childSym]; } // } } -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UIView * view = [[UIView alloc] init]; view.backgroundColor = backGroundColor; return view; } -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { // if (section == 0){ // return .1; // }else{ return 20; // } } -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ return [UIView new]; } -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { if (section == 0){ return .1; }else{ return .1; } } -(void)click:(UIButton *)btn { // NSString *string = titleArray[btn.tag]; // // myDelegate.where = [NSString stringWithFormat:@"kind = '%@' and car_type = '%@' and subject = '%@'",string,RQ_YDTQuestion_Module.car_type,myDelegate.subject]; // // if (btn.tag == 7) { // myDelegate.where = [NSString stringWithFormat:@"option_type != 0 and car_type = '%@' and subject = '%@'",RQ_YDTQuestion_Module.car_type,myDelegate.subject]; // } // if (btn.tag == 8) { // myDelegate.where = [NSString stringWithFormat:@"media_type = 1 and car_type = '%@' and subject = '%@'",RQ_YDTQuestion_Module.car_type,myDelegate.subject]; // } // if (btn.tag == 16) { // myDelegate.where = [NSString stringWithFormat:@"option_type = 0 and car_type = '%@' and subject = '%@'",RQ_YDTQuestion_Module.car_type,myDelegate.subject]; // } // if (btn.tag == 17) { // myDelegate.where = [NSString stringWithFormat:@"media_type = 2 and car_type = '%@' and subject = '%@'",RQ_YDTQuestion_Module.car_type,myDelegate.subject]; // } // // if (!myDelegate.subject) { // myDelegate.where = [NSString stringWithFormat:@"kind = '%@' and car_type = '%@'",string,RQ_YDTQuestion_Module.car_type]; // // if (btn.tag == 7) { // myDelegate.where = [NSString stringWithFormat:@"option_type != 0 and car_type = '%@'",RQ_YDTQuestion_Module.car_type]; // } // if (btn.tag == 8) { // myDelegate.where = [NSString stringWithFormat:@"media_type = 1 and car_type = '%@'",RQ_YDTQuestion_Module.car_type]; // } // if (btn.tag == 16) { // myDelegate.where = [NSString stringWithFormat:@"option_type = 0 and car_type = '%@'",RQ_YDTQuestion_Module.car_type]; // } // if (btn.tag == 17) { // myDelegate.where = [NSString stringWithFormat:@"media_type = 2 and car_type = '%@'",RQ_YDTQuestion_Module.car_type]; // } // } } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end