TrafficRulesListViewController.m 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. //
  2. // TrafficRulesListViewController.m
  3. // Miaxis
  4. //
  5. // Created by tongjun on 14-1-20.
  6. // Copyright (c) 2014年 tongjun. All rights reserved.
  7. //
  8. #import "TrafficRulesListViewController.h"
  9. #import "SubTitleCell.h"
  10. #import <QuartzCore/QuartzCore.h>
  11. #import "TrafficRulesViewController.h"
  12. @interface TrafficRulesListViewController ()
  13. @end
  14. @implementation TrafficRulesListViewController
  15. @synthesize myTableView;
  16. @synthesize titleList;
  17. @synthesize imagesList;
  18. @synthesize listType;
  19. UILabel *fltitleLable;
  20. @synthesize urlList;
  21. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  22. {
  23. self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  24. if (self) {
  25. }
  26. return self;
  27. }
  28. - (void)viewDidLoad
  29. {
  30. [super viewDidLoad];
  31. [self configNavigationBar];
  32. [self.view setBackgroundColor:[UIColor whiteColor]];
  33. [self typeList];
  34. }
  35. - (void)didReceiveMemoryWarning
  36. {
  37. [super didReceiveMemoryWarning];
  38. }
  39. #pragma mark -
  40. -(void)typeList
  41. {
  42. myTableView = [[UITableView alloc] initWithFrame:kFrame style:UITableViewStylePlain];
  43. myTableView.height -= kNavOffSet;
  44. myTableView.delegate=self;
  45. myTableView.dataSource=self;
  46. UIView* vi = [[UIView alloc] initWithFrame:kFrame];
  47. [myTableView setTableFooterView:vi];
  48. [myTableView setScrollEnabled:NO];
  49. [vi addSelfViewWithRect:CGRectMake(0, 0, kSize.height, 1) Color:KlineColor];
  50. [self.view addSubview:self.myTableView];
  51. switch ([myDelegate.urlType intValue]) {
  52. case 1:
  53. {
  54. [self setTitle:@"政策法规"];
  55. self.titleList=[NSMutableArray arrayWithObjects:@"机动车驾驶证申领和使用规定",@"中华人民共和国道路交通安全法",@"道路交通安全违法行为处理程序规定",@"道路交通事故处理程序规定" ,@"酒驾新规",nil];
  56. self.imagesList=[NSMutableArray arrayWithObjects:@"zhengche",@"zhengche",@"zhengche",@"zhengche",@"zhengche", nil];
  57. self.urlList=[NSMutableArray arrayWithObjects:@"drivingLicense",@"trafficSafetyLaws",@"dealingWithTheLaw",@"accidentDisposal",@"drinkDriving", nil];
  58. subTitles = @[@"驾驶证申领和使用规定",@"道路交通安全法",@"安全违法行为处理程序",@"事故处理程序规定",@"酒驾最新处罚条文"];
  59. }
  60. break;
  61. case 2:
  62. {
  63. [self setTitle:@"考试技巧"];
  64. self.titleList=[NSMutableArray arrayWithObjects:@"2013新交规扣分标准",@"交规巧记忆",@"八种交警手势信号口诀",@"处罚相关题巧记",@"罚款金额题巧记",@"最低、最高时速题巧记",@"安全距离题巧记",@"日期类题巧记",@"易混淆知识",nil];
  65. self.imagesList=[NSMutableArray arrayWithObjects:@"xueche",@"xueche",@"xueche",@"xueche",@"xueche",@"xueche",@"xueche",@"xueche",@"xueche", nil];
  66. self.urlList=[NSMutableArray arrayWithObjects:@"points",@"trafficRules",@"gesture",@"punish",@"fine",@"speedPerHour",@"safety",@"date",@"confusable", nil];
  67. }
  68. break;
  69. case 3:
  70. {
  71. [self setTitle:@"科目二"];
  72. self.titleList=[NSMutableArray arrayWithObjects:@"坡道定点停车和起步",@"直角转弯",@"曲线行驶",@"侧方停车",@"倒车入库",nil];
  73. self.imagesList=[NSMutableArray arrayWithObjects:@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist", nil];
  74. self.urlList=[NSMutableArray arrayWithObjects:@"two",@"three",@"four",@"five",@"six",nil];
  75. }
  76. break;
  77. case 4:
  78. {
  79. [self setTitle:@"考场经验"];
  80. self.titleList=[NSMutableArray arrayWithObjects:@"考试流程详解",@"掉头技巧",@"路考必过七步",nil];
  81. self.imagesList=[NSMutableArray arrayWithObjects:@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist", nil];
  82. self.urlList=[NSMutableArray arrayWithObjects:@"lukaomiji",@"diaotoujiqiao",@"zuohaoqibu",@"ruhetongguo",@"wuzhaoyuanli",@"yekaozhuyi",nil];
  83. }
  84. break;
  85. case 5:
  86. {
  87. [self setTitle:@"秘籍指导"];
  88. self.titleList=[NSMutableArray arrayWithObjects:@"如何通过交叉路口",@"五招克服路考恐惧",@"夜考注意事项",nil];
  89. self.imagesList=[NSMutableArray arrayWithObjects:@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist",@"icon_skilllist", nil];
  90. self.urlList=[NSMutableArray arrayWithObjects:@"ruhetongguo",@"wuzhaoyuanli",@"yekaozhuyi",nil];
  91. }
  92. break;
  93. }
  94. }
  95. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  96. {
  97. return [self.titleList count];
  98. }
  99. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  100. {
  101. SubTitleCell *cell=[tableView dequeueReusableCellWithIdentifier:@"CellIdentifier"];
  102. if (cell==nil) {
  103. cell=[[SubTitleCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"CellIdentifier"];
  104. }
  105. [cell setIndex:indexPath.row + 1];
  106. [cell.textLabel setText:titleList[indexPath.row]];
  107. // [cell.detailTextLabel setText:subTitles[indexPath.row]];
  108. return cell;
  109. }
  110. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  111. {
  112. return 70.0;
  113. }
  114. //点击列表中某一行触发的对应操作
  115. -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  116. {
  117. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  118. myDelegate.url=[NSString stringWithFormat:@"%@;%@",[titleList objectAtIndex:indexPath.row],[urlList objectAtIndex:indexPath.row]];
  119. TrafficRulesViewController *vc=[[TrafficRulesViewController alloc]init];
  120. [self navPushHideTabbarToVC:vc];
  121. }
  122. @end