YOUPAILZLiveInviteVC.m 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. //
  2. // YOUPAILZLiveInviteVC.m
  3. // TIANYAN
  4. //
  5. // Created by CY on 2021/5/28.
  6. // Copyright © 2021 leo. All rights reserved.
  7. //
  8. #import "YOUPAILZLiveInviteVC.h"
  9. #import "YOUPAILZLiveInviteListVC.h"
  10. #import "JXCategoryView.h"
  11. #import "JXPagerListRefreshView.h"
  12. @interface YOUPAILZLiveInviteVC () <JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
  13. @property (nonatomic,assign) LZLiveInviteType youpaiptype;
  14. @property (nonatomic, weak) JXPagerListRefreshView *youpaippagerView;
  15. @property (nonatomic, strong) JXCategoryTitleView *youpaipcategoryView;
  16. @end
  17. @implementation YOUPAILZLiveInviteVC
  18. -(instancetype)initWithType:(LZLiveInviteType)type{
  19. if (self = [super init]) {
  20. _youpaiptype = type;
  21. }
  22. return self;
  23. }
  24. - (void)viewDidLoad {
  25. [super viewDidLoad];
  26. self.view.backgroundColor = [UIColor clearColor];
  27. [self youpaifinitUI];
  28. }
  29. - (void)youpaifinitUI{
  30. UIView *bgV = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, KScreenWidth, ScaleSize(343.0f))];
  31. bgV.layer.borderColor = HexColorFromRGB(0x4F4B5B).CGColor;
  32. bgV.layer.borderWidth = 0.5f;
  33. bgV.backgroundColor = LCBkgColor;
  34. [LCTools clipCorner:UIRectCornerTopLeft|UIRectCornerTopRight View:bgV size:CGSizeMake(20.0f, 20.0f)];
  35. [self.view addSubview:bgV];
  36. [bgV mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.left.right.bottom.offset(0.0f);
  38. make.height.offset(ScaleSize(343.0f));
  39. }];
  40. UILabel *titleL = [[UILabel alloc] init];
  41. titleL.font = LCFont17;
  42. titleL.textColor = [UIColor whiteColor];
  43. titleL.textAlignment = NSTextAlignmentCenter;
  44. titleL.text = self.titleStr;
  45. [bgV addSubview:titleL];
  46. [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.left.top.right.offset(0.0f);
  48. make.height.offset(49.0f);
  49. }];
  50. JXCategoryTitleView *youpaipcategoryView = [[JXCategoryTitleView alloc] init];
  51. youpaipcategoryView.backgroundColor = LCBkgColor;
  52. youpaipcategoryView.titles = self.titles;
  53. youpaipcategoryView.delegate = self;
  54. youpaipcategoryView.titleSelectedColor = [UIColor whiteColor];
  55. youpaipcategoryView.titleColor = HexColorFromRGB(0x9F9DA5);
  56. youpaipcategoryView.titleColorGradientEnabled = YES;
  57. youpaipcategoryView.titleFont = LCFont(16.0f);
  58. youpaipcategoryView.titleSelectedFont = LCFont(16.0f);
  59. youpaipcategoryView.cellSpacing = 0.0f;
  60. youpaipcategoryView.averageCellSpacingEnabled = YES;
  61. [bgV addSubview:youpaipcategoryView];
  62. self.youpaipcategoryView = youpaipcategoryView;
  63. [youpaipcategoryView mas_makeConstraints:^(MASConstraintMaker *make) {
  64. make.left.right.offset(0.0f);
  65. make.top.equalTo(titleL.mas_bottom).offset(0.0f);
  66. make.height.offset(43.0f);
  67. }];
  68. JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
  69. lineView.verticalMargin = 4.0f;
  70. lineView.indicatorHeight = 2.0f;
  71. lineView.indicatorWidth = 18.0f;
  72. lineView.indicatorColor = [UIColor whiteColor];
  73. lineView.layer.cornerRadius = 1.0f;
  74. lineView.clipsToBounds = YES;
  75. youpaipcategoryView.indicators = @[lineView];
  76. JXCategoryListContainerView *pagerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_CollectionView delegate:self];
  77. pagerView.listCellBackgroundColor = LCBkgColor;
  78. [bgV addSubview:pagerView];
  79. youpaipcategoryView.listContainer = pagerView;
  80. [pagerView mas_makeConstraints:^(MASConstraintMaker *make) {
  81. make.left.right.bottom.offset(0.0f);
  82. make.top.equalTo(youpaipcategoryView.mas_bottom).offset(0.0f);
  83. }];
  84. }
  85. - (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
  86. return self.titles.count;
  87. }
  88. - (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
  89. YOUPAILZLiveInviteListVC *vc = [[YOUPAILZLiveInviteListVC alloc] initWithType:self.youpaiptype];
  90. vc.youpaipis_invite = index;
  91. WeakSelf;
  92. [vc setYoupaipinviteBlock:^(LZLiveInviteType type, YOUPAILZLiveInviteModel * _Nonnull model) {
  93. [weakSelf dismissViewControllerAnimated:YES completion:^{
  94. if (weakSelf.youpaipinviteBlock != nil) {
  95. weakSelf.youpaipinviteBlock(type, model);
  96. }
  97. }];
  98. }];
  99. return vc;
  100. }
  101. - (NSArray <NSString *>*)titles{
  102. return @[@"可邀请的女神",@"最近邀请过的人"];
  103. }
  104. - (NSString *)titleStr{
  105. if (self.youpaiptype == LZLiveInviteTypePK) {
  106. return @"发起PK";
  107. }else{
  108. return @"发起连麦";
  109. }
  110. }
  111. @end