| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- //
- // MORedPacketHistoryView.m
- // MiMoLive
- //
- // Created by SuperC on 2024/6/13.
- //
- #import "MORedPacketHistoryView.h"
- #import "JXCategoryTitleBackgroundView.h"
- #import "MORedPacketHistoryTableView.h"
- @interface MORedPacketHistoryView ()<JXCategoryViewDelegate,JXCategoryListContainerViewDelegate>
- @property (weak, nonatomic) IBOutlet UILabel *titleLab;
- @property (nonatomic, strong) JXCategoryTitleView *titleCategoryView;
- @property (nonatomic, strong) JXCategoryListContainerView *listContainerView;
- @end
- @implementation MORedPacketHistoryView
- + (instancetype)moRedPacketHistoryView{
- return [[[NSBundle mainBundle] loadNibNamed:@"MORedPacketHistoryView" owner:self options:nil] firstObject];
- }
- - (void)awakeFromNib{
- [super awakeFromNib];
-
- self.titleLab.text = NSLocalString(@"mimo_red_packet_history_title");
- self.titleLab.font = [MOTextTools getTheFontWithSize:18 AndFontName:kNormalContentFontStr];
- self.titleLab.textColor = [MOTools colorWithHexString:@"#333333"];
-
- self.layer.cornerRadius = 16.0;
- self.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
-
- self.titleCategoryView.titles = @[NSLocalString(@"mimo_red_packet_history_received"),NSLocalString(@"mimo_red_packet_history_issued")];
- CGFloat totalItemWidth = 280.0;
- self.titleCategoryView.layer.cornerRadius = 30.0 / 2.0;
- self.titleCategoryView.layer.masksToBounds = YES;
- self.titleCategoryView.cellSpacing = 0;
- self.titleCategoryView.cellWidth = totalItemWidth / self.titleCategoryView.titles.count;
- self.titleCategoryView.titleColor = [MOTools colorWithHexString:@"#FFFFFF" alpha:1.0];
- self.titleCategoryView.titleSelectedColor = [MOTools colorWithHexString:@"#6B2800" alpha:1.0];
- self.titleCategoryView.titleFont = [MOTextTools getTheFontWithSize:13.0 AndFontName:kNormalContentFontStr];
- self.titleCategoryView.titleSelectedFont = [MOTextTools getTheFontWithSize:13.0 AndFontName:kNormalContentBlodFontStr];
- self.titleCategoryView.backgroundColor = [MOTools colorWithHexString:@"#C3BDB9"];
- self.titleCategoryView.layer.borderColor = [MOTools colorWithHexString:@"#FFBB95" alpha:0.5].CGColor;
- self.titleCategoryView.layer.borderWidth = 1;
-
- JXCategoryIndicatorBackgroundView *backgroundTwoView = [[JXCategoryIndicatorBackgroundView alloc] init];
- backgroundTwoView.indicatorHeight = 30.0;
- backgroundTwoView.indicatorWidthIncrement = 0;
- backgroundTwoView.indicatorColor = [MOTools colorWithHexString:@"#FFEC85" alpha:1.0];
-
- NSArray *colorTwoArr = @[[MOTools colorWithHexString:@"#FAEFA7"],[MOTools colorWithHexString:@"#FFB54C"]];
- UIImage *imageTwo = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, 142.0, 30.0) Colors:colorTwoArr GradientType:0];
- UIImageView *imgTwoBgView = [[UIImageView alloc] init];
- imgTwoBgView.contentMode = UIViewContentModeScaleToFill;
- [imgTwoBgView setImage:imageTwo];
- [backgroundTwoView addSubview:imgTwoBgView];
- [imgTwoBgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.equalTo(backgroundTwoView);
- }];
- imgTwoBgView.layer.cornerRadius = 15;
- imgTwoBgView.layer.masksToBounds = YES;
- imgTwoBgView.layer.borderColor = [MOTools colorWithHexString:@"#FFBB95"].CGColor;
- imgTwoBgView.layer.borderWidth = 1;
-
- self.titleCategoryView.indicators = @[backgroundTwoView];
- [self addSubview:self.titleCategoryView];
- [self.titleCategoryView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self).offset(60.0);
- make.centerX.equalTo(self);
- make.width.equalTo(@(totalItemWidth));
- make.height.equalTo(@30.0);
- }];
-
- [self addSubview:self.listContainerView];
- [self.listContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.equalTo(self).offset(108.0);
- make.left.right.bottom.equalTo(self);
- }];
- self.titleCategoryView.listContainer = self.listContainerView;
- }
- - (IBAction)closeBtnClick:(id)sender {
- [self dismissRedPacketHistoryView];
- }
- // 点击选中或者滚动选中都会调用该方法。适用于只关心选中事件,不关心具体是点击还是滚动选中的。
- - (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{
- MORedPacketHistoryTableView *view = [[MORedPacketHistoryTableView alloc] init];
- view.viewType = index;
- return view;
- }
- - (void)showRedPacketHistoryView{
- [UIView animateWithDuration:0.3 animations:^{
- self.transform = CGAffineTransformMakeTranslation(0, -self.height);
- [self layoutIfNeeded];
- }];
- }
- - (void)dismissRedPacketHistoryView{
- [UIView animateWithDuration:0.3 animations:^{
- self.transform = CGAffineTransformIdentity;
- [self layoutIfNeeded];
- }];
- }
- #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;
- }
- @end
|