| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- //
- // MOLiveCenterTableView.m
- // MiMoLive
- //
- // Created by SuperC on 2023/12/5.
- //
- #import "MOLiveCenterTableView.h"
- @interface MOLiveCenterTableView ()<UITableViewDelegate,UITableViewDataSource>
- @end
- @implementation MOLiveCenterTableView
- - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style
- {
- self = [super initWithFrame:frame style:style];
- if (self)
- {
- self.delegate = self;
- self.dataSource = self;
- [self registerClass:[MOLiveCenterBaseCell class] forCellReuseIdentifier:MOLiveCenterBaseCell_ID];
- }
- return self;
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- {
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- if(self.cellType == MOLiveCenterUserCellType){
- return self.dataArr.count;
- }
- else{
- return 3;
- }
-
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- if(self.cellType == MOLiveCenterUserCellType){
- MOLiveCenterBaseCell *cell = [tableView dequeueReusableCellWithIdentifier:MOLiveCenterBaseCell_ID];
- if (cell == nil){
- cell = [[MOLiveCenterBaseCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MOLiveCenterBaseCell_ID];
- }
- if(self.dataArr.count > 0){
- MOPersonList *model = self.dataArr[indexPath.row];
- cell.cellModel = model;
- }
-
- return cell;
- }
- else{
- MOListCenterTitleCell *cell = [tableView dequeueReusableCellWithIdentifier:MOListCenterTitleCell_ID];
- if (cell == nil){
- cell = [[MOListCenterTitleCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MOListCenterTitleCell_ID];
- }
-
- if(indexPath.row == 0){
- cell.titleLab.text = NSLocalString(@"mimo_live_center_wish_list_reward");
- [cell.goldNumBtn setTitle:[NSString stringWithFormat:@"%.f",self.otherGoldenBean] forState:UIControlStateNormal];
- cell.rightImg.hidden = NO;
- }
- else if(indexPath.row == 1){
- cell.titleLab.text = NSLocalString(@"mimo_live_center_like_list");
- [cell.goldNumBtn setTitle:[NSString stringWithFormat:@"%.f",self.likeGoldenBean] forState:UIControlStateNormal];
- cell.rightImg.hidden = YES;
- }
- else if (indexPath.row == 2){
- cell.titleLab.text = NSLocalString(@"mimo_live_center_divide_list");
- [cell.goldNumBtn setTitle:[NSString stringWithFormat:@"%.f",self.divideGoldenBean] forState:UIControlStateNormal];
- cell.rightImg.hidden = YES;
- }
-
- return cell;
- }
-
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- return 65.0;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- [tableView deselectRowAtIndexPath:indexPath animated:YES];
-
- if(self.cellType == MOLiveCenterUserCellType){
-
- if(self.dataArr.count > 0){
- MOPersonList *model = self.dataArr[indexPath.row];
- self.cellClickBlock ? self.cellClickBlock(model) : nil;
- }
-
- }
- else{
-
- if(indexPath.row == 1 || indexPath.row == 2){
- return;
- }
-
- self.wishCellClickBlock ? self.wishCellClickBlock() : nil;
- }
-
- }
- - (NSMutableArray *)dataArr{
- if(!_dataArr){
- _dataArr = [NSMutableArray array];
- }
- return _dataArr;
- }
- @end
|