GuideVC.m 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. //
  2. // GuideVC.m
  3. // jiaPei
  4. //
  5. // Created by apple on 15/11/20.
  6. // Copyright (c) 2015年 JCZ. All rights reserved.
  7. //
  8. #import "GuideVC.h"
  9. #import "AdvertisingColumn.h"
  10. #import "STButton.h"
  11. #import "GDButton.h"
  12. #import "TRDetailVC.h"
  13. #import "PicSymbol.h"
  14. #import "GuideHtmlVC.h"
  15. #define redTint [UIColor colorWithRed:255/255.0 green:100/255.0 blue:20/255.0 alpha:1]
  16. @interface GuideVC ()
  17. {
  18. UIScrollView* scroll;
  19. }
  20. @end
  21. @implementation GuideVC
  22. - (void)viewDidLoad {
  23. [super viewDidLoad];
  24. [self myInit];
  25. }
  26. - (void)didReceiveMemoryWarning {
  27. [super didReceiveMemoryWarning];
  28. // Dispose of any resources that can be recreated.
  29. }
  30. #pragma mark -
  31. -(void)myInit
  32. {
  33. scroll = [[UIScrollView alloc] initWithFrame:kFrame];
  34. scroll.height -= kNavOffSet + kSafeAreaBottomHeight;
  35. [scroll setContentSize:SGSizeMake(0, 550)];
  36. [self.view addSubview:scroll];
  37. [self.view setBackgroundColor:[UIColor whiteColor]];
  38. [self configNavigationBar];
  39. [self setTitle:@"学车指南"];
  40. CGFloat bd = 10;
  41. AdvertisingColumn *adView = [[AdvertisingColumn alloc]initWithFrame:CGRectMake(0, 0, kSize.width, kSize.width*9/32.0)];
  42. //广告
  43. NSMutableArray *newAD = [NSMutableArray array];
  44. for (NSDictionary *dic in myDelegate.adArray) {
  45. if ([dic[@"LOCATION"] isEqualToString:@"2"]) {
  46. [newAD addObject:dic];
  47. }
  48. }
  49. [adView setImgArray:newAD];
  50. adView.supVC = self;
  51. [scroll addSubview:adView];
  52. STButton* btn;
  53. CGFloat btnH ,btnW;
  54. CGFloat labH;
  55. NSInteger tag =0;
  56. CGFloat currentTop;
  57. UIView* vi;
  58. UILabel* label;
  59. NSArray* titles;
  60. NSArray* subTitles;
  61. NSArray* images;
  62. /**因为不需要修改btn,所以不用保存起来
  63. 其实可以用{}把每个section给包括起来的。
  64. */
  65. //SECTION
  66. {
  67. currentTop = kSize.width*9/32.0;
  68. labH = 30;
  69. label = [[UILabel alloc] initWithFrame:CGRectMake(bd*2, currentTop, kSize.width, labH)];
  70. [label setText:@"考前准备"];
  71. [scroll addSubview:label];
  72. [label addViewWithRect:CGRectMake(0, currentTop + labH, kSize.width, 1)];
  73. CGFloat lee = [label sizeThatFits:CGSizeMake(kSize.width, MAXFLOAT)].height;
  74. vi = [[UIView alloc] initWithFrame:CGRectMake(bd, currentTop+(labH-lee)/2, 3, lee)];
  75. [vi setBackgroundColor:defGreen];
  76. [scroll addSubview:vi];
  77. titles = @[@"图标",@"法规"];//@"须知",
  78. subTitles = @[@"交通标志大全",@"交通法律法规"];//@"报名须知事项",
  79. images = @[@"subject2_standart_icon.png",@"subject3_secret_guide_icon.png"];//@"subject3_exam_onload_icon.png",
  80. btnW = kSize.width / titles.count;
  81. btnH = btnW*.7;
  82. currentTop += labH;
  83. tag += 1;//@"须知"
  84. for (int i =0; i<titles.count; i++)
  85. {
  86. btn = [[STButton alloc] initWithFrame:CGRectMake(btnW*i, currentTop, btnW, btnH)];
  87. [btn setImage:[UIImage imageNamed:images[i]] withTitle:titles[i] Font:13 forState:UIControlStateNormal];
  88. [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
  89. [btn setTitleColor:contentTextColor forState:UIControlStateNormal];
  90. [btn setSubTitle:subTitles[i]];
  91. [scroll addSubview:btn];
  92. [btn setTag:tag++];
  93. [btn addViewWithRect:CGRectMake(btnW*i-1, currentTop, 1, btnH)];
  94. }
  95. }
  96. // //SECTION
  97. // {
  98. // currentTop += btnH + bd;
  99. // label = [[UILabel alloc] initWithFrame:CGRectMake(bd*2, currentTop, kSize.width, labH)];
  100. // [label setText:@"学车技巧"];
  101. // [scroll addSubview:label];
  102. // [label addViewWithRect:CGRectMake(0, currentTop-bd, kSize.width, bd) Color:KlineColor];
  103. // [label addViewWithRect:CGRectMake(0, currentTop + labH, kSize.width, 1)];
  104. //
  105. // CGFloat lee = [label sizeThatFits:CGSizeMake(kSize.width, MAXFLOAT)].height;
  106. // vi = [[UIView alloc] initWithFrame:CGRectMake(bd, currentTop+(labH-lee)/2, 3, lee)];
  107. // [vi setBackgroundColor:[UIColor redColor]];
  108. // [scroll addSubview:vi];
  109. //
  110. // images = @[@"guide_icon1.png",@"guide_icon2.png",@"guide_icon3.png",@"guide_icon4.png"];
  111. // titles = @[@"科目一",@"科目二",@"科目三",@"科目四"];
  112. // subTitles = @[@"备战理论考试",@"科目二小路考",@"科目三大路考",@"备考安全文明"];
  113. // btnW = kSize.width/2;
  114. // btnH = btnW*.3;
  115. // currentTop += labH;
  116. // for (int i =0; i< 4; i++)
  117. // {
  118. // GDButton* btn = [[GDButton alloc] initWithFrame:CGRectMake(btnW*(i%2), currentTop + btnH*(int)(i/2), btnW-2, btnH-2)];
  119. // [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
  120. // [btn setDetailText:subTitles[i]];
  121. // [btn setImage:[UIImage imageNamed:images[i]] withTitle:titles[i] Font:NormalFont forState:UIControlStateNormal];
  122. // [btn setDetailText:subTitles[i]];
  123. // [scroll addSubview:btn];
  124. // [btn setTag:tag++];
  125. // }
  126. // [btn addViewWithRect:CGRectMake(btnW, currentTop, 1, btnH*2)];
  127. // [btn addViewWithRect:CGRectMake(0, currentTop + btnH, kSize.width, 1)];
  128. // }
  129. tag += 4;
  130. //SECTION
  131. {
  132. images = @[@"guide_icon5.png",@"guide_icon6.png",@"guide_icon7.png",@"guide_icon8.png"];
  133. currentTop += btnH + bd;
  134. label = [[UILabel alloc] initWithFrame:CGRectMake(bd*2, currentTop, kSize.width, labH)];
  135. [label setText:@"新手上路"];
  136. [scroll addSubview:label];
  137. [label addViewWithRect:CGRectMake(0, currentTop-bd, kSize.width, bd) Color:KlineColor];
  138. [label addViewWithRect:CGRectMake(0, currentTop + labH, kSize.width, 1)];
  139. CGFloat lee = [label sizeThatFits:CGSizeMake(kSize.width, MAXFLOAT)].height;
  140. vi = [[UIView alloc] initWithFrame:CGRectMake(bd, currentTop+(labH-lee)/2, 3, lee)];
  141. [vi setBackgroundColor:[UIColor blueColor]];
  142. [scroll addSubview:vi];
  143. titles = @[@"指南",@"新手",@"处理",@"易错"];
  144. subTitles = @[@"驾照使用指南",@"新手上路指导",@"故障和事故处理",@"新手易犯错误"];
  145. btnW = kSize.width/2;
  146. btnH = btnW*.3;
  147. currentTop += labH;
  148. for (int i =0; i< 4; i++)
  149. {
  150. GDButton* btn = [[GDButton alloc] initWithFrame:CGRectMake(btnW*(i%2), currentTop + btnH*(int)(i/2), btnW-2, btnH-2)];
  151. [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
  152. [btn setImage:[UIImage imageNamed:images[i]] withTitle:titles[i] Font:NormalFont forState:UIControlStateNormal];
  153. [scroll addSubview:btn];
  154. [btn setDetailText:subTitles[i]];
  155. [btn setTag:tag++];
  156. }
  157. [btn addViewWithRect:CGRectMake(btnW, currentTop, 1, btnH*2)];
  158. [btn addViewWithRect:CGRectMake(0, currentTop + btnH, kSize.width, 1)];
  159. }
  160. //SECTION
  161. {
  162. images = @[@"guide_icon10.png",@"guide_icon11.png",@"guide_icon12.png",@"guide_icon13.png"];//@"guide_icon9.png",
  163. currentTop += btnH*2 + bd;
  164. label = [[UILabel alloc] initWithFrame:CGRectMake(bd*2, currentTop, kSize.width, labH)];
  165. [label setText:@"资格证技巧"];
  166. [scroll addSubview:label];
  167. [label addViewWithRect:CGRectMake(0, currentTop-bd, kSize.width, bd) Color:KlineColor];
  168. [label addViewWithRect:CGRectMake(0, currentTop + labH, kSize.width, .5)];
  169. CGFloat lee = [label sizeThatFits:CGSizeMake(kSize.width, MAXFLOAT)].height;
  170. vi = [[UIView alloc] initWithFrame:CGRectMake(bd, currentTop+(labH-lee)/2, 3, lee)];
  171. [vi setBackgroundColor:[UIColor redColor]];
  172. [scroll addSubview:vi];
  173. titles = @[@"货运",@"客运",@"危险品",@"出租车"];//@"教练员",
  174. subTitles = @[@"货物顺利送达",@"安全旅行服务",@"确保安全",@"全心服务乘客"];//@"培养合格驾驶员",
  175. btnW = kSize.width/2;
  176. btnH = btnW*.3;
  177. currentTop += labH;
  178. tag += 1;
  179. for (int i =0; i< titles.count; i++)
  180. {
  181. GDButton* btn = [[GDButton alloc] initWithFrame:CGRectMake(btnW*(i%2), currentTop + btnH*(int)(i/2), btnW-2, btnH-2)];
  182. [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
  183. [btn setImage:[UIImage imageNamed:images[i]] withTitle:titles[i] Font:NormalFont forState:UIControlStateNormal];
  184. [scroll addSubview:btn];
  185. [btn setDetailText:subTitles[i]];
  186. [btn setTag:tag++];
  187. }
  188. [btn addViewWithRect:CGRectMake(btnW, currentTop, 1, btnH*2)];
  189. [btn addViewWithRect:CGRectMake(0, currentTop + btnH, kSize.width, 1)];
  190. [btn addViewWithRect:CGRectMake(0, currentTop + btnH*2, kSize.width, 1)];
  191. // [btn addViewWithRect:CGRectMake(0, currentTop + btnH*3, kSize.width, 1)];
  192. }
  193. vi = [scroll.subviews lastObject];
  194. [scroll setContentSize:CGSizeMake(0, CGRectGetMaxY(vi.frame)+60)];
  195. }
  196. -(void)btnClick:(UIButton*)sender
  197. {
  198. int tag = (int)sender.tag;
  199. //NSLog(@"btn%d click",(int)sender.tag);
  200. if (1 == tag) {
  201. PicSymbol *symbol = [[PicSymbol alloc] init];
  202. [self navPushHideTabbarToVC:symbol];
  203. return;
  204. }
  205. //从服务器获取
  206. if (tag > 2 ) {
  207. GuideHtmlVC *htmlVC = [[GuideHtmlVC alloc] init];
  208. htmlVC.searchID = [NSString stringWithFormat:@"%d",tag + 6];
  209. [htmlVC setTitle:sender.titleLabel.text];
  210. [self navPushHideTabbarToVC:htmlVC];
  211. return;
  212. }
  213. //从本地获取
  214. TRListVC* vc = [TRListVC new];
  215. NSArray* arr;
  216. if (0 == tag) {
  217. arr = @[@"2015最新版学车择校指南(新手必看)",
  218. @"选择驾校的七个关键词",
  219. @"(2015版)学车流程:学车体检考试相关规定",
  220. @"学车指南 - 学车体检项目流程和须知",
  221. @"考驾照有四关,学交规是关键",
  222. @"机动车驾驶员申领、办理、增驾、换证指南",
  223. @"学车指南 - 色盲色弱如何考驾照?"];
  224. [vc setTitle:@"须知"];
  225. }
  226. if (2 == tag) {
  227. arr = @[@"2016《机动车驾驶证申领和使用规定》",
  228. @"中华人民共和国道路交通安全法",
  229. @"道路交通安全违法行为处理程序规定",
  230. @"道路交通事故处理程序规定",
  231. @"酒驾新规"];
  232. [vc setTitle:@"交通法规"];
  233. }
  234. //下面的弃用 先放着吧 不是很影响
  235. if (3 == tag) {
  236. arr = @[@"科目一考试技巧记忆口诀",
  237. @"科目一考试应试必备技巧",
  238. @"科目一到科目四,超牛的驾考经验技巧,科科必过!",
  239. @"理论考试知识汇总",
  240. @"【科目一】交规巧记十三条!",
  241. @"3分钟,快速掌握考试车内提示灯如何操作",
  242. @"日期类题目最头痛,来看看我们总结的快速学习方法!",
  243. @"帮您快速巧记交规秘诀,看完想不过都难!",
  244. @"交规理论考试十大“给力”攻略"];
  245. [vc setTitle:@"科目一"];
  246. }
  247. if (4 == tag) {
  248. arr = @[@"科目二小错误千万别大意",
  249. @"科目二到底考什么?全部都在这",
  250. @"科目二考试不过的原因大解析",
  251. @"侧方停车只是倒车速度慢一点,为什么判不过?",
  252. @"考官说扣分:“驾考科目二场考五项讲解全攻略”",
  253. @"科目二考试技巧口诀,小伙伴要记牢哦",
  254. @"科目二考试详细流程",
  255. @"科目二之直角拐弯",
  256. @"科目二考场温馨提示要点图",
  257. @"侧方停车技巧,超详细!",
  258. @"四张图让你秒变倒车界的独孤求败!",
  259. @"倒车入库再也不发愁,蜀黍教你各种倒车技巧!",
  260. @"科目二五项过关神技巧,超级详细!",
  261. @"因为这些挂掉,冤枉死!",
  262. @"科目二坡道,这些不良动作是你考试不过关的根源!",
  263. @"倒车入位用这三招,想怎么钻就怎么钻!",
  264. @"科目二失分点都在这,想过来看!",
  265. @"倒车入库究竟有多难?",
  266. @"学车入门级知识问题",
  267. @"科二全程解剖,让“菜鸟级”的你轻松通过考试",
  268. @"直角转弯操作技巧,一看秒懂",
  269. @"六张图,教会你“侧方停车”神技能",
  270. @"全程考试技巧汇总",
  271. @"坡道定点停车技巧(图解)",
  272. @"坡道定点找三十公分线的技巧方法",
  273. @"考驾照14条关键经验,学员含泪总结",
  274. @"科目二考前准备",
  275. @"科目二合格标准",
  276. @"科目二必过考试经验分享",
  277. @"坡道起步怎么预防倒溜和熄火?",
  278. @"科目二全程“难点”独家解析!",
  279. @"科二最难的:倒车入口+坡道起步独家秘笈",
  280. @"你必须注意的科目二考试须知!"];
  281. [vc setTitle:@"科目二"];
  282. }
  283. if (5 == tag) {
  284. arr = @[@"科目三考试评判标准,提前了解不失分",
  285. @"科目三原来是这样丢分的",
  286. @"三招提高科目三考试成功率",
  287. @"科目三考试详细流程",
  288. @"科三再升级“人考”改“机考”车内多名安全员",
  289. @"科目三--加减档位操作",
  290. @"夜考,用这几招轻轻松松过",
  291. @"科目三大路考之靠边停车小技巧",
  292. @"科目三:模拟夜间行驶场景灯光使用技巧",
  293. @"超详细科目三考试口令速记口诀!",
  294. @"控制科目三方向的几个生死关键点",
  295. @"2015年科目三考试新规则和扣分标准",
  296. @"科目三:路考超车须知",
  297. @"科目三:电子路考需要注意什么",
  298. @"科目三:老手教你靠边停车技术",
  299. @"科目三:路考变更车道须知",
  300. @"科目三:路考通过人行横道线须知",
  301. @"科目三:路考中14项细节必需注意",
  302. @"考试指南 - 科目三路考评判标准",
  303. @"考试指南 - 科目三路考秘诀",
  304. @"考试指南 - 科目三必过的考场经验分享",
  305. @"考试指南 - 科目三抽到夜间考试怎么办?",
  306. @"考试指南 - 夜考灯光使用攻略,看完就过了!",
  307. @"考试指南 - 科目三路考会车攻略"];
  308. [vc setTitle:@"科目三"];
  309. }
  310. if (6 == tag) {
  311. arr = @[@"科目四考试须知与技巧",
  312. @"科目三都过了,还怕败在科目四?",
  313. @"科目四有几次补考机会?",
  314. @"科目四考什么?",
  315. @"考试指南 - 最全的科目四考试技巧口诀"];
  316. [vc setTitle:@"科目四"];
  317. }
  318. if (7 == tag) {
  319. arr = @[@"驾考路上26条倾心经验,每条都是真理!",
  320. @"什么是科目一?科目二?科目三?科目四?全都在这",
  321. @"科目一别尽顾着做题,直接看这里就够啦!",
  322. @"学车八计:学会你就是考神",
  323. @"我敢说,这些交通标志,你肯定分不清楚!",
  324. @"10年资深教练员的各科目必过经验",
  325. @"想要顺利通过驾考,请牢记这些!",
  326. @"如何调后视镜减少盲区最安全?",
  327. @"非常实用转弯技巧,从此不再紧张!",
  328. @"顺利拿驾照,须做这5点",
  329. @"记住这个,再也不怕被扣分了!",
  330. @"12条在驾校绝对学不到的驾驶技巧,看完胜开十年车!",
  331. @"美女教练员亲自上阵为大家奉上起步不熄火的绝招!",
  332. @"考官总结驾考中最易失误的几大问题",
  333. @"你能开什么车?驾驶证对应准驾车型一览!",
  334. @"支招女学员愉快轻松学车指南",
  335. @"驾照使用指南 - 驾照年审、年检",
  336. @"驾照使用指南 - 驾照换证流程",
  337. @"驾照使用指南 - 驾照遗失怎么办?",
  338. @"驾照使用指南 - 驾照如何挂失"];
  339. [vc setTitle:@"指南"];
  340. }
  341. if (8 == tag) {
  342. arr = @[@"十大技巧让新手不挨欺,这样的换挡最有效率。",
  343. @"新手上路指导 - 驾校不教的知识 车上奇怪的“故障”",
  344. @"“右侧超车”,你,真的了解么?",
  345. @"学会这些驾驶经验,你也可以风骚开路",
  346. @"这些招数都学会了,开车不再是难题",
  347. @"新手上路指南 - 特殊天气驾驶技巧",
  348. @"新手上路指南 - 车辆操作",
  349. @"夜间行驶必备技巧",
  350. @"新手上路需知,如何正确安全跟车?",
  351. @"必备停车技巧——基本停车",
  352. @"刹车技巧",
  353. @"驾驶员必须掌握-最危险的五大驾车错觉",
  354. @"遇大陡坡莫手足无措 新手需掌握7点注意",
  355. @"慌乱刹车就熄火 新手开车刹车攻略"];
  356. [vc setTitle:@"新手"];
  357. }
  358. if (9 == tag) {
  359. arr = @[@"交通事故的处理流程是怎么样的?你知道么?",
  360. @"新手上路指导 - 驾校不教的知识 车上奇怪的“故障”",
  361. @"新手上路指导 - 刹车失灵的五种解决办法",
  362. @"别给自己找麻烦!易被警察拿下的小物件"];
  363. [vc setTitle:@"处理"];
  364. }
  365. if (10 == tag) {
  366. arr = @[@"告诉你一些“边缘交规” 省得违规了还不知道",
  367. @"有种绿灯不能闯!绿灯也会罚",
  368. @"新手易犯的5个错误 改掉坏习惯最重要",
  369. @"新手上路指导 - 雨中行车注意,发动机进水不要启动车辆",
  370. @"新手上路指导 -汽车小修不求人"];
  371. [vc setTitle:@"易错"];
  372. }
  373. if (11 == tag) {//教练资格证已取消,已被屏蔽
  374. arr = @[@"教练员实际操作要领考核要求",
  375. @"教练员资格证考试流程",
  376. @"教练员上岗前应具备的知识和技能",
  377. @"教练员“红线”知多少?"];
  378. [vc setTitle:@"教练员"];
  379. }
  380. if (12 == tag) {
  381. arr = @[@"B2大货车倒桩操作指南详解",
  382. @"大货车坡道定点停车和起步技巧详解",
  383. @"大货车直角转弯驾驶技巧",
  384. @"货车驾驶证申请",
  385. @"货车从业资格管理",
  386. @"货车从业资格证人员管理规定"];
  387. [vc setTitle:@"货运"];
  388. }
  389. if (13 == tag) {
  390. arr = @[@"客运职业道德与安全行车知识",
  391. @"客运汽车使用技术",
  392. @"客运汽车常见故障处理",
  393. @"客运道路旅客运输知识",
  394. @"客运道路运输法规",
  395. @"客运驾驶证"];
  396. [vc setTitle:@"客运"];
  397. }
  398. if (14 == tag) {
  399. arr = @[@"危险化学品常识"];
  400. [vc setTitle:@"危险品"];
  401. }
  402. if (15 == tag) {
  403. arr = @[@"出租车安全运营与治安防范",
  404. @"出租车职业道德与服务规范",
  405. @"出租车节能驾驶",
  406. @"出租车使用与常见故障处理",
  407. @"出租车运价知识与计价器使用",
  408. @"出租车道路交通事故处理与应急救护",
  409. @"出租车汽车政策、法规、标准",
  410. @"出租车服务质量信誉考核"];
  411. [vc setTitle:@"出租车"];
  412. }
  413. [vc setModels:arr];
  414. [self navPushHideTabbarToVC:vc];
  415. }
  416. @end