// // TrafficRulesListViewController.m // Miaxis // // Created by tongjun on 14-1-20. // Copyright (c) 2014年 tongjun. All rights reserved. // #import "TrafficRulesListViewController.h" #import "SubTitleCell.h" #import #import "TrafficRulesViewController.h" @interface TrafficRulesListViewController () @end @implementation TrafficRulesListViewController @synthesize myTableView; @synthesize titleList; @synthesize imagesList; @synthesize listType; UILabel *fltitleLable; @synthesize urlList; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { } return self; } - (void)viewDidLoad { [super viewDidLoad]; [self configNavigationBar]; [self.view setBackgroundColor:[UIColor whiteColor]]; [self typeList]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } #pragma mark - -(void)typeList { myTableView = [[UITableView alloc] initWithFrame:kFrame style:UITableViewStylePlain]; myTableView.height -= kNavOffSet; myTableView.delegate=self; myTableView.dataSource=self; UIView* vi = [[UIView alloc] initWithFrame:kFrame]; [myTableView setTableFooterView:vi]; [myTableView setScrollEnabled:NO]; [vi addSelfViewWithRect:CGRectMake(0, 0, kSize.height, 1) Color:KlineColor]; [self.view addSubview:self.myTableView]; switch ([myDelegate.urlType intValue]) { case 1: { [self setTitle:@"政策法规"]; self.titleList=[NSMutableArray arrayWithObjects:@"机动车驾驶证申领和使用规定",@"中华人民共和国道路交通安全法",@"道路交通安全违法行为处理程序规定",@"道路交通事故处理程序规定" ,@"酒驾新规",nil]; self.imagesList=[NSMutableArray arrayWithObjects:@"zhengche",@"zhengche",@"zhengche",@"zhengche",@"zhengche", nil]; self.urlList=[NSMutableArray arrayWithObjects:@"drivingLicense",@"trafficSafetyLaws",@"dealingWithTheLaw",@"accidentDisposal",@"drinkDriving", nil]; subTitles = @[@"驾驶证申领和使用规定",@"道路交通安全法",@"安全违法行为处理程序",@"事故处理程序规定",@"酒驾最新处罚条文"]; } break; case 2: { [self setTitle:@"考试技巧"]; self.titleList=[NSMutableArray arrayWithObjects:@"2013新交规扣分标准",@"交规巧记忆",@"八种交警手势信号口诀",@"处罚相关题巧记",@"罚款金额题巧记",@"最低、最高时速题巧记",@"安全距离题巧记",@"日期类题巧记",@"易混淆知识",nil]; self.imagesList=[NSMutableArray arrayWithObjects:@"xueche",@"xueche",@"xueche",@"xueche",@"xueche",@"xueche",@"xueche",@"xueche",@"xueche", nil]; self.urlList=[NSMutableArray arrayWithObjects:@"points",@"trafficRules",@"gesture",@"punish",@"fine",@"speedPerHour",@"safety",@"date",@"confusable", nil]; } break; case 3: { [self setTitle:@"科目二"]; self.titleList=[NSMutableArray arrayWithObjects:@"坡道定点停车和起步",@"直角转弯",@"曲线行驶",@"侧方停车",@"倒车入库",nil]; self.imagesList=[NSMutableArray arrayWithObjects:@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist", nil]; self.urlList=[NSMutableArray arrayWithObjects:@"two",@"three",@"four",@"five",@"six",nil]; } break; case 4: { [self setTitle:@"考场经验"]; self.titleList=[NSMutableArray arrayWithObjects:@"考试流程详解",@"掉头技巧",@"路考必过七步",nil]; self.imagesList=[NSMutableArray arrayWithObjects:@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist", nil]; self.urlList=[NSMutableArray arrayWithObjects:@"lukaomiji",@"diaotoujiqiao",@"zuohaoqibu",@"ruhetongguo",@"wuzhaoyuanli",@"yekaozhuyi",nil]; } break; case 5: { [self setTitle:@"秘籍指导"]; self.titleList=[NSMutableArray arrayWithObjects:@"如何通过交叉路口",@"五招克服路考恐惧",@"夜考注意事项",nil]; self.imagesList=[NSMutableArray arrayWithObjects:@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist", nil]; self.urlList=[NSMutableArray arrayWithObjects:@"ruhetongguo",@"wuzhaoyuanli",@"yekaozhuyi",nil]; } break; } } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.titleList count]; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { SubTitleCell *cell=[tableView dequeueReusableCellWithIdentifier:@"CellIdentifier"]; if (cell==nil) { cell=[[SubTitleCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"CellIdentifier"]; } [cell setIndex:indexPath.row + 1]; [cell.textLabel setText:titleList[indexPath.row]]; // [cell.detailTextLabel setText:subTitles[indexPath.row]]; return cell; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 70.0; } //点击列表中某一行触发的对应操作 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:YES]; myDelegate.url=[NSString stringWithFormat:@"%@;%@",[titleList objectAtIndex:indexPath.row],[urlList objectAtIndex:indexPath.row]]; TrafficRulesViewController *vc=[[TrafficRulesViewController alloc]init]; [self navPushHideTabbarToVC:vc]; } @end