JXGiftViewController.m 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. //
  2. // JXGiftViewController.m
  3. // shiku_im
  4. //
  5. // Created by qiudezheng on 2020/4/20.
  6. // Copyright © 2020 Reese. All rights reserved.
  7. //
  8. #import "JXGiftViewController.h"
  9. #import "JXRedPackageViewController.h"
  10. #import "JXGoldenManagerViewController.h"
  11. #import "JXApplyViewController.h"
  12. #import "JXProcuratorViewController.h"
  13. @interface JXGiftViewController ()
  14. @property(strong,nonatomic)UIScrollView * scrollView;
  15. @property(strong,nonatomic)UIView * navigationView;
  16. @property(strong,nonatomic)NSArray * titleArrays;
  17. @property(strong,nonatomic)NSArray * imageArrays;
  18. @end
  19. @implementation JXGiftViewController
  20. - (void)viewDidLoad {
  21. [super viewDidLoad];
  22. self.view.backgroundColor=[UIColor whiteColor];
  23. self.titleArrays = @[@"红包雨",@"金管家",@"开发中",@"开发中"];
  24. self.imageArrays = @[@"redpackageRain",@"goldenManagerImage",@"fininshedImage",@"applyingImage"];
  25. [self initNavigationView];
  26. [self initComponents];
  27. }
  28. -(void)initNavigationView
  29. {
  30. // self.navigationItem.title=@"让未来现在就来";
  31. // return;
  32. self.navigationView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, JX_SCREEN_WIDTH, JX_SCREEN_HEIGHT>=812?44:44)];
  33. self.navigationView.backgroundColor = [UIColor whiteColor];
  34. [self.view addSubview:self.navigationView];
  35. UILabel * titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 2, JX_SCREEN_WIDTH, 40)];
  36. titleLabel.text = @"让未来现在就来";
  37. titleLabel.textColor = [UIColor blackColor];
  38. titleLabel.font = [UIFont systemFontOfSize:18.0f];
  39. titleLabel.textAlignment = NSTextAlignmentCenter;
  40. [self.navigationView addSubview:titleLabel];
  41. }
  42. -(void)initComponents
  43. {
  44. UIImageView * banner1 = [[UIImageView alloc]initWithFrame:CGRectMake(10, self.navigationView.frame.size.height + 5, JX_SCREEN_WIDTH - 20, 0.437f*(JX_SCREEN_WIDTH - 30))];
  45. banner1.image = [UIImage imageNamed:@"banner1"];
  46. [self.view addSubview:banner1];
  47. UITapGestureRecognizer * bannerTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bannerTaps:)];
  48. bannerTap.numberOfTapsRequired = 1;
  49. bannerTap.numberOfTouchesRequired = 1;
  50. banner1.userInteractionEnabled = YES;
  51. [banner1 addGestureRecognizer:bannerTap];
  52. UIImageView * banner2 = [[UIImageView alloc]initWithFrame:CGRectMake(10, banner1.frame.origin.y + banner1.frame.size.height + 10, banner1.frame.size.width, banner1.frame.size.height)];
  53. banner2.image = [UIImage imageNamed:@"banner2"];
  54. [self.view addSubview:banner2];
  55. UITapGestureRecognizer * bannerTap2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bannerTaps2:)];
  56. bannerTap2.numberOfTapsRequired = 1;
  57. bannerTap2.numberOfTouchesRequired = 1;
  58. banner2.userInteractionEnabled = YES;
  59. [banner2 addGestureRecognizer:bannerTap2];
  60. float betweenFloat = JX_SCREEN_WIDTH - (JX_SCREEN_WIDTH / 2 - 15) * 2 - 20;
  61. for(int i=0;i<=1;i++)
  62. {
  63. for(int j=0;j<=1;j++)
  64. {
  65. 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))];
  66. image.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",[self.imageArrays objectAtIndex:(i*2+j)]]];
  67. [self.view addSubview:image];
  68. UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(15, 0, image.frame.size.width, image.frame.size.height)];
  69. label.text = [NSString stringWithFormat:@"%@",[self.titleArrays objectAtIndex:(i*2+j)]];
  70. label.textColor = [UIColor blackColor];
  71. label.font = [UIFont boldSystemFontOfSize:24.0f];
  72. [image addSubview:label];
  73. UITapGestureRecognizer * tapGest = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(redTaps:)];
  74. tapGest.numberOfTapsRequired = 1;
  75. tapGest.numberOfTouchesRequired = 1;
  76. image.userInteractionEnabled = YES;
  77. image.tag = i*2+j + 10000;
  78. [image addGestureRecognizer:tapGest];
  79. }
  80. }
  81. }
  82. -(void)bannerTaps:(UITapGestureRecognizer *)ges
  83. {
  84. JXApplyViewController * apply = [[JXApplyViewController alloc]init];
  85. apply.hidesBottomBarWhenPushed = YES;
  86. [g_navigation pushViewController:apply animated:YES];
  87. }
  88. -(void)bannerTaps2:(UITapGestureRecognizer *)ges
  89. {
  90. JXProcuratorViewController * apply = [[JXProcuratorViewController alloc]init];
  91. apply.hidesBottomBarWhenPushed = YES;
  92. [g_navigation pushViewController:apply animated:YES];
  93. }
  94. -(void)redTaps:(UITapGestureRecognizer *)gesture
  95. {
  96. UIImageView * image = (UIImageView *)[gesture view];
  97. if(image.tag == 10000)
  98. {
  99. JXRedPackageViewController * red = [[JXRedPackageViewController alloc]init];
  100. red.hidesBottomBarWhenPushed = YES;
  101. [g_navigation pushViewController:red animated:YES];
  102. }
  103. if(image.tag == 10001)
  104. {
  105. JXGoldenManagerViewController * red = [[JXGoldenManagerViewController alloc]init];
  106. red.hidesBottomBarWhenPushed = YES;
  107. [g_navigation pushViewController:red animated:YES];
  108. }
  109. }
  110. -(void)initDataSource
  111. {
  112. }
  113. - (void)viewWillAppear:(BOOL)animated{
  114. [super viewWillAppear:animated];
  115. [self.navigationController setNavigationBarHidden:YES animated:NO];
  116. }
  117. - (void)viewWillDisappear:(BOOL)animated{
  118. [super viewWillDisappear:animated];
  119. [self.navigationController setNavigationBarHidden:NO animated:NO];
  120. }
  121. @end