BogoInviteDetailViewController.m 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. //
  2. // BogoInviteDetailViewController.m
  3. // UniversalApp
  4. //
  5. // Created by Mac on 2021/6/10.
  6. // Copyright © 2021 voidcat. All rights reserved.
  7. //
  8. #import "BogoInviteDetailViewController.h"
  9. #import "BogoInviteDetailSubViewController.h"
  10. #import "BogoInviteDetailTopView.h"
  11. #import "BogoInviteWithDrawViewController.h"
  12. #import "BogoInviteWithDrawLogViewController.h"
  13. @interface BogoInviteDetailViewController ()<BogoInviteDetailTopViewDelegate>{
  14. NSArray *list;
  15. }
  16. @property(nonatomic, strong) MLMSegmentHead *segHead;
  17. @property(nonatomic, strong) MLMSegmentScroll *segScroll;
  18. @property(nonatomic, strong) NSMutableArray *vcArray;
  19. @property(nonatomic, strong) BogoInviteDetailTopView *topView;
  20. @end
  21. @implementation BogoInviteDetailViewController
  22. - (void)viewDidLoad {
  23. [super viewDidLoad];
  24. // Do any additional setup after loading the view.
  25. self.title =ASLocalizedString( @"我的邀请详情");
  26. [self.view addSubview:self.topView];
  27. [self addSubController];
  28. [self performSelector:@selector(updateLayout) afterDelay:0.25];
  29. }
  30. - (void)updateLayout{
  31. self.topView.height = 98;
  32. }
  33. - (void)addSubController {
  34. list = @[
  35. ASLocalizedString(@"一级邀请"),
  36. ASLocalizedString(@"二级邀请")];
  37. _segHead = [[MLMSegmentHead alloc] initWithFrame:CGRectMake(15, 98 + 15, SCREEN_WIDTH, 52) titles:list headStyle:SegmentHeadStyleLine layoutStyle:MLMSegmentLayoutLeft];
  38. //tab颜色
  39. _segHead.selectColor = [UIColor colorWithHexString:@"#333333"];
  40. _segHead.deSelectColor = [UIColor colorWithHexString:@"#777777"];
  41. _segHead.lineColor = [UIColor colorWithHexString:@"#FD4161"];
  42. _segHead.deSelectFont = [UIFont systemFontOfSize:16];
  43. _segHead.selectFont = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
  44. _segHead.lineHeight = 4;
  45. _segHead.headColor = kWhiteColor;
  46. _segHead.lineScale = 0.25;
  47. _segHead.bottomLineHeight = 0;
  48. _segScroll = [[MLMSegmentScroll alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_segHead.frame), SCREEN_WIDTH, kScreenH - FD_Top_Height - 52 - 98 - 15) vcOrViews:self.vcArray];
  49. _segScroll.loadAll = NO;
  50. _segScroll.showIndex = 0;
  51. [MLMSegmentManager associateHead:_segHead withScroll:_segScroll completion:^{
  52. [self.view addSubview:_segHead];
  53. [self.view addSubview:_segScroll];
  54. }];
  55. UIView *line = [_segHead getScrollLineView];
  56. line.layer.cornerRadius = 2;
  57. line.layer.masksToBounds = YES;
  58. CAGradientLayer *gl = [CAGradientLayer layer];
  59. gl.frame = line.bounds;
  60. gl.startPoint = CGPointMake(0, 0.5);
  61. gl.endPoint = CGPointMake(1, 0.5);
  62. gl.colors = @[(__bridge id)[UIColor colorWithHexString:@"#F4491F"].CGColor, (__bridge id)[UIColor colorWithHexString:@"#FF9D45"].CGColor];
  63. gl.locations = @[@(0), @(1.0f)];
  64. [line.layer insertSublayer:gl atIndex:0];
  65. }
  66. #pragma mark - BogoInviteDetailTopViewDelegate
  67. - (void)topView:(BogoInviteDetailTopView *)topView didClickLogBtn:(UIButton *)sender{
  68. BogoInviteWithDrawLogViewController *detailVC = [[BogoInviteWithDrawLogViewController alloc]init];
  69. [self.navigationController pushViewController:detailVC animated:YES];
  70. }
  71. - (void)topView:(BogoInviteDetailTopView *)topView didClickWithDrawBtn:(UIButton *)sender{
  72. BogoInviteWithDrawViewController *withDrawVC = [[BogoInviteWithDrawViewController alloc]init];
  73. [self.navigationController pushViewController:withDrawVC animated:YES];
  74. }
  75. - (NSMutableArray *)vcArray{
  76. if (!_vcArray) {
  77. _vcArray = [NSMutableArray array];
  78. BogoInviteDetailSubViewController *subVC = [[BogoInviteDetailSubViewController alloc]init];
  79. subVC.type = BogoInviteDetailSubViewControllerTypeDirect;
  80. BogoInviteDetailSubViewController *subVC2 = [[BogoInviteDetailSubViewController alloc]init];
  81. subVC2.type = BogoInviteDetailSubViewControllerTypeDirectIndirect;
  82. [_vcArray addObject:subVC];
  83. [_vcArray addObject:subVC2];
  84. }
  85. return _vcArray;
  86. }
  87. - (BogoInviteDetailTopView *)topView{
  88. if (!_topView) {
  89. _topView = [[NSBundle mainBundle] loadNibNamed:@"BogoInviteDetailTopView" owner:nil options:nil].firstObject;
  90. _topView.delegate = self;
  91. }
  92. return _topView;
  93. }
  94. @end