MOInviteBaseView.m 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. //
  2. // MOInviteBaseView.m
  3. // MiMoLive
  4. //
  5. // Created by SuperC on 2024/8/8.
  6. //
  7. #import "MOInviteBaseView.h"
  8. #import "MOInviteTableView.h"
  9. @interface MOInviteBaseView ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
  10. @property (weak, nonatomic) IBOutlet UIView *bgView;
  11. @property (nonatomic, strong) JXCategoryTitleView *titleCategoryView;
  12. @property (nonatomic, strong) JXCategoryListContainerView *listContainerView;
  13. @end
  14. @implementation MOInviteBaseView
  15. + (instancetype)moInviteBaseView{
  16. return [[[NSBundle mainBundle] loadNibNamed:@"MOInviteBaseView" owner:self options:nil] firstObject];
  17. }
  18. - (void)awakeFromNib{
  19. [super awakeFromNib];
  20. self.bgView.layer.cornerRadius = 16.0;
  21. self.bgView.layer.masksToBounds = YES;
  22. self.bgView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
  23. NSArray *titleDataArr = @[NSLocalString(@"mimo_voice_invite_left_title"),NSLocalString(@"mimo_voice_invite_right_title")];
  24. [self.bgView addSubview:self.titleCategoryView];
  25. [self.titleCategoryView mas_makeConstraints:^(MASConstraintMaker *make) {
  26. make.left.right.equalTo(self.bgView).offset(0.0);
  27. make.top.equalTo(self.bgView).offset(15.0);
  28. make.height.equalTo(@30.0);
  29. }];
  30. self.titleCategoryView.titles = titleDataArr;
  31. self.titleCategoryView.titleColor = [MOTools colorWithHexString:@"#8E8A99" alpha:1.0];
  32. self.titleCategoryView.titleSelectedColor = [MOTools colorWithHexString:@"#000000" alpha:1.0];
  33. self.titleCategoryView.titleFont = [MOTextTools getTheFontWithSize:16.0 AndFontName:kTypeOneTitleFontStr];
  34. self.titleCategoryView.titleSelectedFont = [MOTextTools getTheFontWithSize:16.0 AndFontName:kTypeOneTitleFontStr];
  35. self.titleCategoryView.backgroundColor = [UIColor clearColor];
  36. JXCategoryIndicatorBackgroundView *backgroundView = [[JXCategoryIndicatorBackgroundView alloc] init];
  37. backgroundView.indicatorHeight = 8.5;
  38. backgroundView.indicatorWidth = 50.0;
  39. backgroundView.indicatorWidthIncrement = 0;
  40. backgroundView.indicatorColor = [UIColor clearColor];
  41. backgroundView.componentPosition = JXCategoryComponentPosition_Bottom;
  42. backgroundView.verticalMargin = -5.0;
  43. UIImageView *imgBgView = [[UIImageView alloc] init];
  44. imgBgView.contentMode = UIViewContentModeScaleToFill;
  45. [imgBgView setImage:[UIImage imageNamed:@"icon_square_line_new"]];
  46. [backgroundView addSubview:imgBgView];
  47. [imgBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  48. make.edges.equalTo(backgroundView);
  49. }];
  50. self.titleCategoryView.indicators = @[backgroundView];
  51. [self.bgView addSubview:self.listContainerView];
  52. [self.listContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
  53. make.top.equalTo(self.titleCategoryView.mas_bottom).offset(13.0);
  54. make.left.right.bottom.equalTo(self.bgView);
  55. }];
  56. self.titleCategoryView.listContainer = self.listContainerView;
  57. }
  58. // 点击选中或者滚动选中都会调用该方法。适用于只关心选中事件,不关心具体是点击还是滚动选中的。
  59. - (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index{
  60. MOLogV(@"变换了");
  61. }
  62. #pragma mark - JXCategoryListContainerViewDelegate
  63. - (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{
  64. return self.titleCategoryView.titles.count;
  65. }
  66. - (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
  67. MOInviteTableView *view = [[MOInviteTableView alloc] init];
  68. if(index == 0){
  69. view.relation = 2;
  70. }
  71. else{
  72. view.relation = 1;
  73. }
  74. view.roomId = self.roomId;
  75. view.camera = self.camera;
  76. return view;
  77. }
  78. - (IBAction)closeBtnClick:(id)sender {
  79. [self dismissInviteBaseView];
  80. }
  81. - (void)showInviteBaseView{
  82. self.frame = CGRectMake(0, 0, SCREENWIDTH, SCREENHEIGHT);
  83. CGRect actionViewRect = self.bgView.frame;
  84. actionViewRect.origin.y = SCREENHEIGHT;
  85. self.bgView.frame = actionViewRect;
  86. WEAKSELF
  87. [UIView animateWithDuration:0.3 animations:^{
  88. CGRect actionViewRect = weakSelf.bgView.frame;
  89. actionViewRect.origin.y = SCREENHEIGHT - 436.0;
  90. weakSelf.bgView.frame = actionViewRect;
  91. }];
  92. //不能滑动
  93. SendNotification(@"MOShowLivePagesVCCannotScroll")
  94. }
  95. - (void)dismissInviteBaseView{
  96. //完成下移动画
  97. WEAKSELF
  98. [UIView animateWithDuration:0.3 animations:^
  99. {
  100. CGRect actionSheetViewRect = weakSelf.bgView.frame;
  101. actionSheetViewRect.origin.y = SCREENHEIGHT;
  102. weakSelf.bgView.frame = actionSheetViewRect;
  103. } completion:^(BOOL finished)
  104. {
  105. [self removeFromSuperview];
  106. }];
  107. //可以滑动
  108. SendNotification(@"MOShowLivePagesVCCanScroll")
  109. }
  110. #pragma mark - Lazy
  111. - (JXCategoryTitleView *)titleCategoryView{
  112. if(!_titleCategoryView){
  113. _titleCategoryView = [[JXCategoryTitleView alloc] init];
  114. _titleCategoryView.delegate = self;
  115. _titleCategoryView.backgroundColor = [UIColor whiteColor];
  116. }
  117. return _titleCategoryView;
  118. }
  119. - (JXCategoryListContainerView *)listContainerView{
  120. if(!_listContainerView){
  121. _listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
  122. }
  123. return _listContainerView;
  124. }
  125. @end