// // JXGiftViewController.m // shiku_im // // Created by qiudezheng on 2020/4/20. // Copyright © 2020 Reese. All rights reserved. // #import "JXGiftViewController.h" #import "JXRedPackageViewController.h" #import "JXGoldenManagerViewController.h" #import "JXApplyViewController.h" #import "JXProcuratorViewController.h" @interface JXGiftViewController () @property(strong,nonatomic)UIScrollView * scrollView; @property(strong,nonatomic)UIView * navigationView; @property(strong,nonatomic)NSArray * titleArrays; @property(strong,nonatomic)NSArray * imageArrays; @end @implementation JXGiftViewController - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor=[UIColor whiteColor]; self.titleArrays = @[@"红包雨",@"金管家",@"开发中",@"开发中"]; self.imageArrays = @[@"redpackageRain",@"goldenManagerImage",@"fininshedImage",@"applyingImage"]; [self initNavigationView]; [self initComponents]; } -(void)initNavigationView { // self.navigationItem.title=@"让未来现在就来"; // return; self.navigationView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, JX_SCREEN_WIDTH, JX_SCREEN_HEIGHT>=812?44:44)]; self.navigationView.backgroundColor = [UIColor whiteColor]; [self.view addSubview:self.navigationView]; UILabel * titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 2, JX_SCREEN_WIDTH, 40)]; titleLabel.text = @"让未来现在就来"; titleLabel.textColor = [UIColor blackColor]; titleLabel.font = [UIFont systemFontOfSize:18.0f]; titleLabel.textAlignment = NSTextAlignmentCenter; [self.navigationView addSubview:titleLabel]; } -(void)initComponents { UIImageView * banner1 = [[UIImageView alloc]initWithFrame:CGRectMake(10, self.navigationView.frame.size.height + 5, JX_SCREEN_WIDTH - 20, 0.437f*(JX_SCREEN_WIDTH - 30))]; banner1.image = [UIImage imageNamed:@"banner1"]; [self.view addSubview:banner1]; UITapGestureRecognizer * bannerTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bannerTaps:)]; bannerTap.numberOfTapsRequired = 1; bannerTap.numberOfTouchesRequired = 1; banner1.userInteractionEnabled = YES; [banner1 addGestureRecognizer:bannerTap]; UIImageView * banner2 = [[UIImageView alloc]initWithFrame:CGRectMake(10, banner1.frame.origin.y + banner1.frame.size.height + 10, banner1.frame.size.width, banner1.frame.size.height)]; banner2.image = [UIImage imageNamed:@"banner2"]; [self.view addSubview:banner2]; UITapGestureRecognizer * bannerTap2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bannerTaps2:)]; bannerTap2.numberOfTapsRequired = 1; bannerTap2.numberOfTouchesRequired = 1; banner2.userInteractionEnabled = YES; [banner2 addGestureRecognizer:bannerTap2]; float betweenFloat = JX_SCREEN_WIDTH - (JX_SCREEN_WIDTH / 2 - 15) * 2 - 20; for(int i=0;i<=1;i++) { for(int j=0;j<=1;j++) { UIImageView * image = [[UIImageView alloc]initWithFrame:CGRectMake(10 + j * (betweenFloat + JX_SCREEN_WIDTH / 2 - 15), (banner2.frame.origin.y + banner2.frame.size.height + 10) + i*(0.54f * (JX_SCREEN_WIDTH / 2 - 20) + 10), JX_SCREEN_WIDTH / 2 - 15, 0.54f * (JX_SCREEN_WIDTH / 2 - 15))]; image.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",[self.imageArrays objectAtIndex:(i*2+j)]]]; [self.view addSubview:image]; UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, image.frame.size.width, image.frame.size.height)]; label.text = [NSString stringWithFormat:@"%@",[self.titleArrays objectAtIndex:(i*2+j)]]; label.textColor = [UIColor blackColor]; label.font = [UIFont boldSystemFontOfSize:24.0f]; [image addSubview:label]; UITapGestureRecognizer * tapGest = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(redTaps:)]; tapGest.numberOfTapsRequired = 1; tapGest.numberOfTouchesRequired = 1; image.userInteractionEnabled = YES; image.tag = i*2+j + 10000; [image addGestureRecognizer:tapGest]; } } } -(void)bannerTaps:(UITapGestureRecognizer *)ges { JXApplyViewController * apply = [[JXApplyViewController alloc]init]; apply.hidesBottomBarWhenPushed = YES; [g_navigation pushViewController:apply animated:YES]; } -(void)bannerTaps2:(UITapGestureRecognizer *)ges { JXProcuratorViewController * apply = [[JXProcuratorViewController alloc]init]; apply.hidesBottomBarWhenPushed = YES; [g_navigation pushViewController:apply animated:YES]; } -(void)redTaps:(UITapGestureRecognizer *)gesture { UIImageView * image = (UIImageView *)[gesture view]; if(image.tag == 10000) { JXRedPackageViewController * red = [[JXRedPackageViewController alloc]init]; red.hidesBottomBarWhenPushed = YES; [g_navigation pushViewController:red animated:YES]; } if(image.tag == 10001) { JXGoldenManagerViewController * red = [[JXGoldenManagerViewController alloc]init]; red.hidesBottomBarWhenPushed = YES; [g_navigation pushViewController:red animated:YES]; } } -(void)initDataSource { } - (void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [self.navigationController setNavigationBarHidden:YES animated:NO]; } - (void)viewWillDisappear:(BOOL)animated{ [super viewWillDisappear:animated]; [self.navigationController setNavigationBarHidden:NO animated:NO]; } @end