Files
featherVoice/QXLive/Mine(音域)/Controller/亲密关系/QXMoreIntimateViewController.m
2025-11-21 16:17:05 +08:00

77 lines
2.5 KiB
Objective-C

//
// QXMoreIntimateViewController.m
// QXLive
//
// Created by 启星 on 2025/11/20.
//
#import "QXMoreIntimateViewController.h"
#import "QXMineNetwork.h"
#import "QXIntimateMoreListCell.h"
@interface QXMoreIntimateViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UITableView *tableView;
@end
@implementation QXMoreIntimateViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(void)setUserId:(NSString *)userId{
_userId = userId;
}
-(void)setRelation_id:(NSString *)relation_id{
_relation_id = relation_id;
if (self.userId) {
[self getList];
}
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArray.count;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QXIntimateMoreListCell *cell = [QXIntimateMoreListCell cellWithTableView:tableView];
cell.model = self.dataArray[indexPath.row];
MJWeakSelf
cell.topSuccessBlock = ^(QXRelationshipListModel * _Nonnull model) {
[weakSelf getList];
};
cell.deleteSuccessBlock = ^(QXRelationshipListModel * _Nonnull model) {
[weakSelf getList];
};
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return ScaleWidth(92)+16;
}
-(void)getList{
MJWeakSelf
[QXMineNetwork userBestFriendsMoreListWithUserId:self.userId relation_id:self.relation_id successBlock:^(NSArray<QXRelationshipListModel *> * _Nonnull model) {
[weakSelf.dataArray removeAllObjects];
[weakSelf.dataArray addObjectsFromArray:model];
[weakSelf.tableView reloadData];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(UITableView *)tableView{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight+ScaleWidth(68), SCREEN_WIDTH, SCREEN_HEIGHT -NavContentHeight-ScaleWidth(68)) style:(UITableViewStyleGrouped)];
_tableView.dataSource = self;
_tableView.delegate = self;
_tableView.backgroundColor = [UIColor clearColor];
_tableView.tableFooterView = [UIView new];
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
if (@available(iOS 15.0, *)) {
_tableView.sectionHeaderTopPadding = 0;
} else {
// Fallback on earlier versions
}
}
return _tableView;
}
@end