123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- //
- // HmV5.m
- // jiaPei
- //
- // Created by apple on 15/11/13.
- // Copyright (c) 2015年 JCZ. All rights reserved.
- //
- #import "HmV5.h"
- #import "AdvertisingColumn.h"
- #import "TRListVC.h"
- #import "TRDetailVC.h"
- #import "VowBar.h"
- #import "TopicesVC.h"
- @interface HmV5 ()
- @end
- @implementation HmV5
- {
- NSMutableArray *btnArr;
- AdvertisingColumn *adView;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self myInit];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- -(void)myInit
- {
- self.view.height = self.viewH;
- [self.view setBackgroundColor:backGroundColor];
- [self configNavigationBar];
- btnArr = [NSMutableArray array];
-
- scroll = self.zzScrollV;
- [scroll setScrollEnabled:YES];
- [self.view addSubview:scroll];
-
- // UIView* hv = [[UIView alloc] initWithFrame:CGRectMake(0, -200, kSize.width, 200)];
- // [hv setBackgroundColor:backGroundColor];
- // [scroll addSubview:hv];
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateAD:) name:@"updateAD" object:nil];
- adView = [[AdvertisingColumn alloc]initWithFrame:CGRectMake(0, 0, kSize.width, kSize.width*9/32.0)];
- //广告
- NSMutableArray *newAD = [NSMutableArray array];
- for (NSDictionary *dic in myDelegate.adArray) {
-
- if ([dic[@"LOCATION"] isEqualToString:@"7"]) {
-
- [newAD addObject:dic];
- }
- }
- [adView setImgArray:newAD];
- adView.supVC = self;
- [scroll addSubview:adView];
-
- UILabel* label;
- UIButton* btn;
- NSArray* titles;
- CGFloat dx = 15;
- CGFloat dy = 10;
- CGFloat dH = 40;
- int tag = 0;
-
- label = [[UILabel alloc] initWithFrame:CGRectMake(dx, kSize.width*9/32.0+10+dy, kSize.width, dH-dy*2)];
- [label setFont:[UIFont scaleSize:NormalFont]];
- [label setTextColor:subTitleColor];
- [scroll addSubview:label];
- [label setText:@"领照须知"];
-
-
- titles = @[@"驾照年审、年检",@"驾照换证",@"驾照遗失",@"驾照挂失"];
- for (int i=0; i<titles.count; i++) {
- CGFloat fontSize = NormalFont;
-
- btn = [[UIButton alloc] initWithFrame:CGRectMake(kSize.width/2*(i%2), dH*(int)(i/2) + label.bottom + 10, (kSize.width-1) / 2.f, dH-1)];
- [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
- [btn.titleLabel setFont:[UIFont scaleSize:fontSize]];
- [btn setTitleColor:kTitleColor forState:UIControlStateNormal];
- [btn setTitle:titles[i] forState:UIControlStateNormal];
- [btn setBackgroundColor:[UIColor whiteColor]];
- // CGSize titleSize = [btn.titleLabel.text sizeForFont:fontSize];
- // [btn setContentEdgeInsets:UIEdgeInsetsMake(0, dx, 0, btn.frame.size.width - dx - titleSize.width)];
- [scroll addSubview:btn];
- [btnArr addObject:btn];
- [btn setTag:tag++];
- }
-
-
- label = [[UILabel alloc] initWithFrame:CGRectMake(dx, btn.bottom + 10 + dy, kSize.width, dH-dy*2)];
- [label setFont:[UIFont scaleSize:NormalFont]];
- [label setTextColor:subTitleColor];
- [scroll addSubview:label];
- [label setText:@"新手上路"];
-
- titles = @[@"车辆操作",@"特殊天气驾驶技巧",@"夜间行驶必备",@"刹车技巧",@"事故处理技巧",@"必备停车技巧"];
- for (int i=0; i<titles.count; i++)
- {
- CGFloat fontSize = NormalFont;
-
- btn = [[UIButton alloc] initWithFrame:CGRectMake(kSize.width/2*(i%2), dH*(int)(i/2) + label.bottom + 10, (kSize.width-1) / 2.f, dH-1)];
- [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
- [btn.titleLabel setFont:[UIFont scaleSize:fontSize]];
- [btn setTitleColor:kTitleColor forState:UIControlStateNormal];
- [btn setTitle:titles[i] forState:UIControlStateNormal];
- [btn setBackgroundColor:[UIColor whiteColor]];
- // CGSize titleSize = [btn.titleLabel.text sizeForFont:fontSize];
- // [btn setContentEdgeInsets:UIEdgeInsetsMake(0, dx, 0, btn.frame.size.width - dx - titleSize.width)];
- [scroll addSubview:btn];
- [btnArr addObject:btn];
- [btn setTag:tag++];
- }
-
- //加一项许愿
- VowBar *vowItem;
- vowItem = [[VowBar alloc] initWithFrame:CGRectMake(0, [[scroll subviews] lastObject].bottom + 10, kFrame.size.width, VAWBAR_H) title:@"下证"];
- vowItem.countLabel.text = @"点击参与讨论>>";
- [vowItem.topicBtn addTarget:self action:@selector(vowClick:) forControlEvents:UIControlEventTouchUpInside];
- vowItem.topicBtn.tag = 11;
- [vowItem.vomBtn addTarget:self action:@selector(vowClick:) forControlEvents:UIControlEventTouchUpInside];
- vowItem.vomBtn.tag = 12;
-
- // [scroll addSubview:vowItem];
- [scroll setContentSize:CGSizeMake(0, CGRectGetMaxY(vowItem.frame)+SCRV_BottomH)];
- }
- - (void)updateAD:(NSNotification *)notifica
- {
- NSMutableArray *newAD = [NSMutableArray array];
- for (NSDictionary *dic in myDelegate.adArray) {
-
- if ([dic[@"LOCATION"] isEqualToString:@"7"]) {
-
- [newAD addObject:dic];
- }
- }
- [adView setImgArray:newAD];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:@"updateAD" object:nil];
- }
- -(void)vowClick:(UIButton *)btn
- {
- TopicesVC* vc = [[TopicesVC alloc] init];
- vc.type = @"1";
- if (btn.tag == 11)
- {
- vc.groupId = @"8";
- }
- else
- {
- vc.groupId = @"9";
- }
- [self navPushHideTabbarToVC:vc];
- }
- -(void)btnClick:(UIButton*)sender
- {
- int tag = (int)sender.tag;
- // NSLog(@"btn%d click",(int)sender.tag);
- if (9 == tag) {
- TRListVC *vc = [[TRListVC alloc] init];
- NSArray* arr = @[@"基本停车",
- @"垂直式停车位",
- @"侧方停车位",
- @"斜线停车位",
- @"串联式停车",
- @"并联式停车",
- @"地下车库停车位",
- @"非字形停车位"];
-
- [vc setModels:arr];
- [vc setTitle:@"必备停车技巧"];
- [self navPushHideTabbarToVC:vc];
- return;
- }
-
-
- TRDetailVC* vc = [[TRDetailVC alloc] init];
- switch (tag) {
- case 0:
- [vc setFile:@"驾照年审、年检"];
- break;
- case 1:
- [vc setFile:@"驾照换证"];
- break;
- case 2:
- [vc setFile:@"驾照使用指南 - 驾照遗失怎么办?"];
- break;
- case 3:
- [vc setFile:@"驾照挂失"];
- break;
- case 4:
- [vc setFile:@"新手上路指南 - 车辆操作"];
- break;
- case 5:
- [vc setFile:@"新手上路指南 - 特殊天气驾驶技巧"];
- break;
- case 6:
- [vc setFile:@"夜间行驶必备技巧"];
- break;
- case 7:
- [vc setFile:@"刹车技巧"];
- break;
- case 8:
- [vc setFile:@"事故处理技巧"];
- break;
- default:
- break;
- }
- [self navPushHideTabbarToVC:vc];
- }
- -(void)dealloc
- {
- [[NSNotificationCenter defaultCenter] removeObserver:self name:@"updateAD" object:nil];
- //下边这个其实不用写的 我们的项目应该不会被用在arc环境下
- #if ! __has_feature(objc_arc)
- [super dealloc];
- #endif
- }
- @end
|