Files
midi_ios/QXLive/HomePage(声播)/Controlller/房间/QXRedBagRecordViewController.m
2025-10-12 15:48:35 +08:00

227 lines
9.0 KiB
Objective-C

//
// QXRedBagRecordViewController.m
// QXLive
//
// Created by 启星 on 2025/10/11.
//
#import "QXRedBagRecordViewController.h"
@class QXRedBagRecordCell;
@interface QXRedBagRecordViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UIView *topView;
@property (nonatomic,strong)UIImageView *topImageView;
@property (nonatomic,strong)UIImageView *senderHeaderImageView;
@property (nonatomic,strong)UILabel *senderNameLabel;
@property (nonatomic,strong)UILabel *remarkLabel;
@property (nonatomic,strong)UILabel *moneyLabel;
@property (nonatomic,strong)UILabel *bottomLabel;
@property (nonatomic,strong)UILabel *countLabel;
@property (nonatomic,strong)UITableView *tableView;
@end
@implementation QXRedBagRecordViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)initSubViews{
self.topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(308))];
self.topImageView = [[UIImageView alloc] init];
self.topImageView.image = [UIImage imageNamed:@"red_bag_record_top_bg"];
[self.topView addSubview:self.topImageView];
[self.topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.bottom.left.right.equalTo(self.topView);
}];
self.senderNameLabel = [[UILabel alloc] init];
self.senderNameLabel.textColor = RGB16(0xffffff);
self.senderNameLabel.font = [UIFont systemFontOfSize:18];
self.senderNameLabel.text = @"傻狗涛的红包";
[self.topView addSubview:self.senderNameLabel];
[self.senderNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.topView).offset(41);;
make.top.equalTo(self.topView).offset(92);
}];
self.senderHeaderImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.senderHeaderImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.senderHeaderImageView addRoundedCornersWithRadius:20.5];
[self.topView addSubview:self.senderHeaderImageView];
[self.senderHeaderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.senderNameLabel.mas_left).offset(-13);
make.centerY.equalTo(self.senderNameLabel);
make.width.height.mas_equalTo(41);
}];
self.remarkLabel = [[UILabel alloc] init];
self.remarkLabel.text = @"恭喜发财大吉大利";
self.remarkLabel.textColor = RGB16(0xffffff);
self.remarkLabel.font = [UIFont systemFontOfSize:13];
[self.topView addSubview:self.remarkLabel];
[self.remarkLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.senderHeaderImageView.mas_bottom).offset(5);
make.height.mas_equalTo(26);
make.centerX.equalTo(self.topView);
}];
self.moneyLabel = [[UILabel alloc] init];
self.moneyLabel.font = [UIFont boldSystemFontOfSize:19];
self.moneyLabel.textColor = RGB16(0xffffff);
self.moneyLabel.text = @"5000金币";
[self.topView addSubview:self.moneyLabel];
[self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.topView);
make.top.equalTo(self.remarkLabel.mas_bottom);
}];
self.bottomLabel = [[UILabel alloc] init];
self.bottomLabel.textColor = RGB16(0xffffff);
self.bottomLabel.text = @"已存入金币";
self.bottomLabel.font = [UIFont systemFontOfSize:13];
[self.topView addSubview:self.bottomLabel];
[self.bottomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.topView);
make.top.equalTo(self.moneyLabel.mas_bottom);
}];
self.countLabel = [[UILabel alloc] init];
self.countLabel.textColor = RGB16(0x999999);
self.countLabel.font = [UIFont systemFontOfSize:13];
self.countLabel.text = @"已领取0/0";
[self.topView addSubview:self.countLabel];
[self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo (15);
make.bottom.mas_equalTo(-10);
}];
[self.view addSubview:self.topView];
[self.dataArray addObject:@""];
[self.dataArray addObject:@""];
[self.dataArray addObject:@""];
[self.dataArray addObject:@""];
[self.dataArray addObject:@""];
self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:(UITableViewStylePlain)];
self.tableView.dataSource = self;
self.tableView.delegate = self;
self.tableView.backgroundColor = RGB16(0xffffff);
self.tableView.rowHeight = 67;
// self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
[self.view addSubview:self.tableView];
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.equalTo(self.view);
make.top.equalTo(self.topView.mas_bottom);
}];
UIButton*backBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, kSafeAreaTop, 44, 44)];
[backBtn setImage:[[UIImage imageNamed:@"back"] imageByTintColor:UIColor.whiteColor] forState:(UIControlStateNormal)];
// backBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeading;
[backBtn addTarget:self action:@selector(backAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.view addSubview:backBtn];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXRedBagRecordCell *cell = [QXRedBagRecordCell cellWithTabelView:tableView];
return cell;
}
-(void)backAction{
[self.navigationController popViewControllerAnimated:YES];
}
@end
@interface QXRedBagRecordCell()
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UIImageView *userHeaderImageView;
@property (nonatomic,strong)UILabel *nameLabel;
@property (nonatomic,strong)UILabel *timeLabel;
@property (nonatomic,strong)UILabel *moneyLabel;
@end
@implementation QXRedBagRecordCell
+(instancetype)cellWithTabelView:(UITableView *)tableView{
static NSString *cellId = @"QXRedBagRecordCell";
QXRedBagRecordCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
if (!cell) {
cell = [[QXRedBagRecordCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId];
}
return cell;
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.backgroundColor = [UIColor clearColor];
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.bgView = [[UIView alloc] init];
[self.contentView addSubview:self.bgView];
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(15);
make.right.mas_equalTo(-15);
make.height.mas_equalTo(52);
make.centerY.equalTo(self.contentView);
}];
self.userHeaderImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
self.userHeaderImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.userHeaderImageView addRoundedCornersWithRadius:24.5];
[self.bgView addSubview:self.userHeaderImageView];
[self.userHeaderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.centerY.equalTo(self.bgView);
make.width.height.mas_equalTo(49);
}];
self.nameLabel = [[UILabel alloc] init];
self.nameLabel.textColor = RGB16(0x666666);
self.nameLabel.text = @"大家好,我是傻狗涛";
self.nameLabel.font = [UIFont systemFontOfSize:14];
[self.bgView addSubview:self.nameLabel];
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.userHeaderImageView.mas_right).offset(13);
make.top.equalTo(self.userHeaderImageView);
make.height.mas_equalTo(26);
}];
self.timeLabel = [[UILabel alloc] init];
self.timeLabel.textColor = RGB16(0x999999);
self.timeLabel.font = [UIFont systemFontOfSize:14];
self.timeLabel.text = @"00:61";
[self.bgView addSubview:self.timeLabel];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.userHeaderImageView.mas_right).offset(13);
make.bottom.equalTo(self.userHeaderImageView);
make.height.mas_equalTo(26);
}];
self.moneyLabel = [[UILabel alloc] init];
self.moneyLabel.textColor = RGB16(0x333333);
self.moneyLabel.text = @"0 金币";
self.moneyLabel.font = [UIFont systemFontOfSize:14];
[self.bgView addSubview:self.moneyLabel];
[self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.bgView);
make.centerY.equalTo(self.bgView);
}];
}
@end