Files
yuyin_ios/SweetParty/主类/音悦新增/麦位弹框子列表/GMMicCharmView.m
2025-08-08 11:05:33 +08:00

73 lines
1.9 KiB
Objective-C
Executable File

//
// GMMicCharmView.m
// SweetParty
//
// Created by bj_szd on 2023/12/25.
//
#import "GMMicCharmView.h"
#import "GMMicCharmCell.h"
@interface GMMicCharmView () <UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, strong) NSArray *dataArray;
@end
@implementation GMMicCharmView
- (void)awakeFromNib {
[super awakeFromNib];
[self createUI];
}
- (void)onFetchDataWith:(NSString *)uid rid:(NSString *)rid {
NSDictionary *params = @{@"user_id":uid, @"rid":rid};
[AFNetworkRequset.shared postRequestWithParams:params Path:@"/api/room_micro/get_room_micro_charm_list" Loading:NO Hud:NO Success:^(id _Nonnull responseDic) {
NSArray *arr = [GMMicCharmModel mj_objectArrayWithKeyValuesArray:responseDic[@"data"]];
self.dataArray = arr;
[self.tableView reloadData];
} Failure:^(id _Nonnull errorData) {
}];
}
- (void)createUI {
WEAK_SELF
[self.touchImgV dg_Tapped:^{
[weakSelf removeFromSuperview];
}];
self.tableView.separatorStyle = NO;
self.tableView.delegate = self;
self.tableView.dataSource = self;
[self.tableView registerNib:[UINib nibWithNibName:@"GMMicCharmCell" bundle:nil] forCellReuseIdentifier:@"GMMicCharmCell"];
self.tableView.rowHeight = 70;
}
- (IBAction)onDismiss:(id)sender {
[self removeFromSuperview];
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.dataArray.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
GMMicCharmCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GMMicCharmCell" forIndexPath:indexPath];
cell.selectionStyle = NO;
GMMicCharmModel *model = self.dataArray[indexPath.row];
cell.model = model;
return cell;
}
@end