| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- //
- // MOPkContributionView.m
- // MiMoLive
- //
- // Created by SuperC on 2024/2/18.
- //
- #import "MOPkContributionView.h"
- #import "MOPkRankContributionTableView.h"
- @interface MOPkContributionView ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
- @property (weak, nonatomic) IBOutlet UIView *bgView;
- @property (weak, nonatomic) IBOutlet UILabel *titleLab;
- @property (nonatomic, strong) JXCategoryTitleView *titleCategoryView;
- @property (nonatomic, strong) UIView *titleBgView;
- @property (nonatomic, strong) JXCategoryListContainerView *listContainerView;
- @end
- @implementation MOPkContributionView
- + (instancetype)moPkContributionView{
- return [[[NSBundle mainBundle] loadNibNamed:@"MOPkContributionView" owner:self options:nil] firstObject];
- }
- - (IBAction)closeBtnClick:(id)sender {
- [self dismissPkContributionView];
- }
- - (void)awakeFromNib{
- [super awakeFromNib];
-
- self.titleLab.font = [MOTextTools getTheFontWithSize:16.0 AndFontName:kNormalContentFontStr];
-
- self.bgView.layer.cornerRadius = 16.0;
- self.bgView.layer.masksToBounds = YES;
-
- [self.bgView addSubview:self.titleBgView];
- [self.titleBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self.titleLab.mas_bottom).offset(12.0);
- make.left.equalTo(self.bgView).offset(45.0);
- make.right.equalTo(self.bgView).offset(-45.0);
- make.height.equalTo(@32.0);
- }];
- self.titleBgView.layer.cornerRadius = 32.0 / 2.0;
-
- [self.bgView addSubview:self.titleCategoryView];
- [self.titleCategoryView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(self.titleBgView.mas_centerY);
- make.left.equalTo(self.bgView).offset(40.0);
- make.right.equalTo(self.bgView).offset(-40.0);
- make.height.equalTo(@70.0);
- }];
-
- self.titleCategoryView.titles = @[@"Our side",@"Other side"];
- CGFloat totalItemWidth = SCREENWIDTH - 40.0 * 2.0 - 22.0 * 2.0;
- self.titleCategoryView.cellSpacing = 0.0;
- self.titleCategoryView.cellWidth = totalItemWidth / self.titleCategoryView.titles.count;
- self.titleCategoryView.titleColor = [MOTools colorWithHexString:@"#737373" alpha:1.0];
- self.titleCategoryView.titleSelectedColor = kBaseBtnBgColor;
- self.titleCategoryView.titleFont = [MOTextTools getTheFontWithSize:15.0 AndFontName:kNormalContentFontStr];
- self.titleCategoryView.titleSelectedFont = [MOTextTools getTheFontWithSize:15.0 AndFontName:kNormalContentFontStr];
- self.titleCategoryView.backgroundColor = [UIColor clearColor];
-
- JXCategoryIndicatorBackgroundView *backgroundView = [[JXCategoryIndicatorBackgroundView alloc] init];
- backgroundView.indicatorHeight = 70.0;
- backgroundView.indicatorWidth = totalItemWidth / self.titleCategoryView.titles.count + 30.0;
- backgroundView.indicatorWidthIncrement = 0;
- backgroundView.indicatorColor = [UIColor clearColor];
- backgroundView.verticalMargin = 4.0;
-
- // NSArray *colorArr = @[[MOTools colorWithHexString:@"#FF62EE" alpha:1.0],[MOTools colorWithHexString:@"#9923FF" alpha:1.0]];
- // UIImage *image = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, (SCREENWIDTH - 15.0 * 2) / 2.0, 40.0) Colors:colorArr GradientType:0];
- UIImageView *imgBgView = [[UIImageView alloc] init];
- imgBgView.contentMode = UIViewContentModeScaleToFill;
- [imgBgView setImage:[UIImage imageNamed:@"icon_rank_btn_bg_apple"]];
- [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(5.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<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index{
- MOPkRankContributionTableView *view = [[MOPkRankContributionTableView alloc] init];
- view.viewType = index + 1;
- view.roomId = self.roomId;
- WEAKSELF
- view.cellClickBlock = ^(NSString * _Nonnull userId, NSInteger viewType) {
- weakSelf.cellClickBlock ? weakSelf.cellClickBlock(userId,viewType) : nil;
- [weakSelf dismissPkContributionView];
- };
- return view;
- }
- #pragma mark - Lazy
- - (JXCategoryTitleView *)titleCategoryView{
- if(!_titleCategoryView){
- _titleCategoryView = [[JXCategoryTitleView alloc] init];
- _titleCategoryView.delegate = self;
- }
- return _titleCategoryView;
- }
- - (JXCategoryListContainerView *)listContainerView{
- if(!_listContainerView){
- _listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
- }
- return _listContainerView;
- }
- - (UIView *)titleBgView{
- if(!_titleBgView){
- _titleBgView = [[UIView alloc] init];
- _titleBgView.backgroundColor = [MOTools colorWithHexString:@"#000000" alpha:0.05];
- }
- return _titleBgView;
- }
- - (UIInterfaceOrientationMask)supportedInterfaceOrientations{
- return UIInterfaceOrientationMaskPortrait;
- }
- - (void)showPkContributionView//界面显示动画
- {
- UIWindow *keyWindow = [[UIApplication sharedApplication] delegate].window;
- [keyWindow addSubview:self];
- self.frame = CGRectMake(0.0, 0.0, SCREENWIDTH, SCREENHEIGHT);
-
- //动画效果
- self.bgView.transform = CGAffineTransformMakeScale(1.3, 1.3);
- self.bgView.alpha = 0;
- [UIView animateWithDuration:0.2 animations:^
- {
- self.bgView.transform = CGAffineTransformMakeScale(1.0, 1.0);
- self.bgView.alpha = 1;
- } completion:^(BOOL finished)
- {
-
- }];
-
- //不能滑动
- SendNotification(@"MOShowLivePagesVCCannotScroll")
- }
- - (void)dismissPkContributionView//取消掉键盘
- {
-
- [UIView animateWithDuration:0.2 animations:^
- {
- self.bgView.transform = CGAffineTransformMakeScale(1.3, 1.3);
- self.bgView.alpha = 0;
- } completion:^(BOOL finished)
- {
- if (finished)
- {
- [self.bgView removeFromSuperview];
- [self removeFromSuperview];
- }
- }];
-
- //可以滑动
- SendNotification(@"MOShowLivePagesVCCanScroll")
- }
- @end
|