// // MOInviteBaseView.m // MiMoLive // // Created by SuperC on 2024/8/8. // #import "MOInviteBaseView.h" #import "MOInviteTableView.h" @interface MOInviteBaseView () @property (weak, nonatomic) IBOutlet UIView *bgView; @property (nonatomic, strong) JXCategoryTitleView *titleCategoryView; @property (nonatomic, strong) JXCategoryListContainerView *listContainerView; @end @implementation MOInviteBaseView + (instancetype)moInviteBaseView{ return [[[NSBundle mainBundle] loadNibNamed:@"MOInviteBaseView" owner:self options:nil] firstObject]; } - (void)awakeFromNib{ [super awakeFromNib]; self.bgView.layer.cornerRadius = 16.0; self.bgView.layer.masksToBounds = YES; self.bgView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner; NSArray *titleDataArr = @[NSLocalString(@"mimo_voice_invite_left_title"),NSLocalString(@"mimo_voice_invite_right_title")]; [self.bgView addSubview:self.titleCategoryView]; [self.titleCategoryView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self.bgView).offset(0.0); make.top.equalTo(self.bgView).offset(15.0); make.height.equalTo(@30.0); }]; self.titleCategoryView.titles = titleDataArr; self.titleCategoryView.titleColor = [MOTools colorWithHexString:@"#8E8A99" alpha:1.0]; self.titleCategoryView.titleSelectedColor = [MOTools colorWithHexString:@"#000000" alpha:1.0]; self.titleCategoryView.titleFont = [MOTextTools getTheFontWithSize:16.0 AndFontName:kTypeOneTitleFontStr]; self.titleCategoryView.titleSelectedFont = [MOTextTools getTheFontWithSize:16.0 AndFontName:kTypeOneTitleFontStr]; self.titleCategoryView.backgroundColor = [UIColor clearColor]; JXCategoryIndicatorBackgroundView *backgroundView = [[JXCategoryIndicatorBackgroundView alloc] init]; backgroundView.indicatorHeight = 8.5; backgroundView.indicatorWidth = 50.0; backgroundView.indicatorWidthIncrement = 0; backgroundView.indicatorColor = [UIColor clearColor]; backgroundView.componentPosition = JXCategoryComponentPosition_Bottom; backgroundView.verticalMargin = -5.0; UIImageView *imgBgView = [[UIImageView alloc] init]; imgBgView.contentMode = UIViewContentModeScaleToFill; [imgBgView setImage:[UIImage imageNamed:@"icon_square_line_new"]]; [backgroundView addSubview:imgBgView]; [imgBgView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(backgroundView); }]; self.titleCategoryView.indicators = @[backgroundView]; [self.bgView addSubview:self.listContainerView]; [self.listContainerView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.titleCategoryView.mas_bottom).offset(13.0); make.left.right.bottom.equalTo(self.bgView); }]; self.titleCategoryView.listContainer = self.listContainerView; } // 点击选中或者滚动选中都会调用该方法。适用于只关心选中事件,不关心具体是点击还是滚动选中的。 - (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index{ MOLogV(@"变换了"); } #pragma mark - JXCategoryListContainerViewDelegate - (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView{ return self.titleCategoryView.titles.count; } - (id)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{ MOInviteTableView *view = [[MOInviteTableView alloc] init]; if(index == 0){ view.relation = 2; } else{ view.relation = 1; } view.roomId = self.roomId; view.camera = self.camera; return view; } - (IBAction)closeBtnClick:(id)sender { [self dismissInviteBaseView]; } - (void)showInviteBaseView{ self.frame = CGRectMake(0, 0, SCREENWIDTH, SCREENHEIGHT); CGRect actionViewRect = self.bgView.frame; actionViewRect.origin.y = SCREENHEIGHT; self.bgView.frame = actionViewRect; WEAKSELF [UIView animateWithDuration:0.3 animations:^{ CGRect actionViewRect = weakSelf.bgView.frame; actionViewRect.origin.y = SCREENHEIGHT - 436.0; weakSelf.bgView.frame = actionViewRect; }]; //不能滑动 SendNotification(@"MOShowLivePagesVCCannotScroll") } - (void)dismissInviteBaseView{ //完成下移动画 WEAKSELF [UIView animateWithDuration:0.3 animations:^ { CGRect actionSheetViewRect = weakSelf.bgView.frame; actionSheetViewRect.origin.y = SCREENHEIGHT; weakSelf.bgView.frame = actionSheetViewRect; } completion:^(BOOL finished) { [self removeFromSuperview]; }]; //可以滑动 SendNotification(@"MOShowLivePagesVCCanScroll") } #pragma mark - Lazy - (JXCategoryTitleView *)titleCategoryView{ if(!_titleCategoryView){ _titleCategoryView = [[JXCategoryTitleView alloc] init]; _titleCategoryView.delegate = self; _titleCategoryView.backgroundColor = [UIColor whiteColor]; } return _titleCategoryView; } - (JXCategoryListContainerView *)listContainerView{ if(!_listContainerView){ _listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self]; } return _listContainerView; } @end