// // QXMoreIntimateViewController.m // QXLive // // Created by 启星 on 2025/11/20. // #import "QXMoreIntimateViewController.h" #import "QXMineNetwork.h" #import "QXIntimateMoreListCell.h" @interface QXMoreIntimateViewController () @property (nonatomic,strong)UITableView *tableView; @end @implementation QXMoreIntimateViewController - (void)viewDidLoad { self.isNoChangeBgImage = YES; [super viewDidLoad]; // Do any additional setup after loading the view. } -(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [self.navigationController setNavigationBarHidden:NO animated:YES]; } -(void)initSubViews{ [super initSubViews]; self.page = 1; [self updateBgImage:@"mine_intimate_bg"]; [self updateBackImage:[UIImage imageNamed:@"mine_intimate_back"]]; UIImageView *titleImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_intimate_title_img"]]; [self.view addSubview:titleImageView]; [titleImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.view); make.width.mas_equalTo(ScaleWidth(178)); make.height.mas_equalTo(ScaleWidth(68)); make.top.mas_equalTo(NavContentHeight); }]; [self.view addSubview:self.tableView]; } -(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.userId = self.userId; 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; } -(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, 50)]; UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_intimate_title_bg"]]; UILabel *titleLabel = [[UILabel alloc] init]; titleLabel.font = [UIFont boldSystemFontOfSize:16]; titleLabel.textColor = RGB16(0xffffff); [header addSubview:imageView]; [header addSubview:titleLabel]; [imageView mas_makeConstraints:^(MASConstraintMaker *make) { make.width.mas_equalTo(132); make.height.mas_equalTo(36); make.centerX.centerY.equalTo(header); }]; [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(header); make.centerY.equalTo(header).offset(2); }]; titleLabel.text = self.relation_name; return header; } -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ return 50; } -(void)getList{ MJWeakSelf [QXMineNetwork userBestFriendsMoreListWithUserId:self.userId relation_id:self.relation_id successBlock:^(NSArray * _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