MGRecommdHeadView.m 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. //
  2. // MGRecommdHeadView.m
  3. // BuguLive
  4. //
  5. // Created by 宋晨光 on 2020/7/10.
  6. // Copyright © 2020 xfg. All rights reserved.
  7. //
  8. #import "MGRecommdHeadView.h"
  9. @implementation MGRecommdHeadView
  10. - (instancetype)initWithFrame:(CGRect)frame
  11. {
  12. self = [super initWithFrame:frame];
  13. if (self) {
  14. [self setupView];
  15. }
  16. return self;
  17. }
  18. -(void)setupView{
  19. [self addSubview:self.regalControl];
  20. [self addSubview:self.charmControl];
  21. }
  22. -(UIControl *)regalControl{
  23. if (!_regalControl) {
  24. CGFloat viewWidth = (kScreenW - kRealValue(8 * 2) - kRealValue(10)) / 2;
  25. _regalControl = [[UIControl alloc]initWithFrame:CGRectMake(kRealValue(8), kRealValue(10), viewWidth, kRealValue(73))];
  26. UILabel *titleL = [[UILabel alloc]initWithFrame:CGRectMake(14, 14, viewWidth - 14 * 2, kRealValue(20))];
  27. titleL.text = ASLocalizedString(@"富豪榜");
  28. titleL.font = [UIFont systemFontOfSize:18];
  29. titleL.textColor = kWhiteColor;
  30. UIImageView *bgImgView = [[UIImageView alloc]initWithFrame:_regalControl.bounds];
  31. bgImgView.image = [UIImage imageNamed:@"mg_recommand_head_regal"];
  32. UILabel *contenL = [[UILabel alloc]initWithFrame:CGRectMake(titleL.left, titleL.bottom + kRealValue(9), viewWidth - 14 * 2, kRealValue(20))];
  33. contenL.text = ASLocalizedString(@"尽显王者荣耀");
  34. contenL.font = [UIFont systemFontOfSize:14];
  35. contenL.textColor = kWhiteColor;
  36. _regalLabel = contenL;
  37. [_regalControl addSubview:bgImgView];
  38. [_regalControl addSubview:titleL];
  39. [_regalControl addSubview:contenL];
  40. [_regalControl addTarget:self action:@selector(clickRegalBtn:) forControlEvents:UIControlEventTouchUpInside];
  41. }
  42. return _regalControl;
  43. }
  44. -(UIControl *)charmControl{
  45. if (!_charmControl) {
  46. CGFloat viewWidth = (kScreenW - kRealValue(8 * 2) + kRealValue(10)) / 2;
  47. _charmControl = [[UIControl alloc]initWithFrame:CGRectMake(kScreenW / 2 + kRealValue(10 / 2), kRealValue(10), viewWidth, kRealValue(73))];
  48. UILabel *titleL = [[UILabel alloc]initWithFrame:CGRectMake(14, 14, viewWidth - 14 * 2, kRealValue(20))];
  49. titleL.text = ASLocalizedString(@"魅力榜");
  50. titleL.font = [UIFont systemFontOfSize:18];
  51. titleL.textColor = kWhiteColor;
  52. UIImageView *bgImgView = [[UIImageView alloc]initWithFrame:_regalControl.bounds];
  53. bgImgView.image = [UIImage imageNamed:@"mg_recommand_head_charm"];
  54. UILabel *contenL = [[UILabel alloc]initWithFrame:CGRectMake(titleL.left, titleL.bottom + kRealValue(9), viewWidth - 14 * 2, kRealValue(20))];
  55. contenL.text = ASLocalizedString(@"魅力释放中");
  56. contenL.font = [UIFont systemFontOfSize:14];
  57. contenL.textColor = kWhiteColor;
  58. _charmLabel = contenL;
  59. [_charmControl addSubview:bgImgView];
  60. [_charmControl addSubview:titleL];
  61. [_charmControl addSubview:contenL];
  62. [_charmControl addTarget:self action:@selector(clickCharmBtn:) forControlEvents:UIControlEventTouchUpInside];
  63. }
  64. return _charmControl;
  65. }
  66. -(void)clickRegalBtn:(UIControl *)sender{
  67. ConsumptionViewController *vc = [[ConsumptionViewController alloc]init];
  68. vc.isHiddenTabbar = YES;
  69. vc.view.backgroundColor = kWhiteColor;
  70. vc.listDayViewController.delegate = self;
  71. vc.listMonthViewController.delegate = self;
  72. vc.listTotalViewController.delegate = self;
  73. [[AppDelegate sharedAppDelegate] pushViewController:vc animated:YES];
  74. }
  75. -(void)clickCharmBtn:(UIControl *)sender{
  76. ContributionViewController *vc = [[ContributionViewController alloc]init];
  77. vc.isHiddenTabbar = YES;
  78. vc.view.backgroundColor = kWhiteColor;
  79. vc.ContriDayViewController.delegate = self;
  80. vc.ContriMonthViewController.delegate = self;
  81. vc.ContriTotalViewController.delegate = self;
  82. [[AppDelegate sharedAppDelegate] pushViewController:vc animated:YES];
  83. }
  84. - (void)pushToHomePage:(UserModel *)model
  85. {
  86. SHomePageVC *homeVC = [[SHomePageVC alloc]init];
  87. homeVC.user_id = model.user_id;
  88. // homeVC.user_nickname =model.nick_name;
  89. homeVC.type = 0;
  90. if ([model.is_noble_ranking_stealth isEqualToString:@"1"] && ![model.user_id isEqualToString:[BGIMLoginManager sharedInstance].loginParam.identifier]) {
  91. [FanweMessage alertHUD:ASLocalizedString(@"不能查看神秘人信息")];
  92. return;
  93. }
  94. [[AppDelegate sharedAppDelegate]pushViewController:homeVC animated:YES];
  95. }
  96. @end