// // 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>"; [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