// // PPFriendViewController.m // tongxin // // Created by ecell on 2023/5/18. // Copyright © 2023 xTT. All rights reserved. // #import "PPFriendViewController.h" #import "CommonTableView.h" #import "PPFriendTableViewCell.h" @interface PPFriendViewController () @property (nonatomic ,strong) CommonTableView *tableView; @property (nonatomic ,strong) NSMutableArray *modelListArr; @end @implementation PPFriendViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.zx_navTitle = @"我的好友"; self.emptyText = @"没有好友"; self.view.backgroundColor = tabViewBG; [self.view addSubview:self.tableView]; [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self.view); make.top.equalTo(self.view).offset(iPhoneX_NavHeight); make.bottom.equalTo(self.view.mas_bottom); }]; [self getListModel]; } - (CommonTableView *)tableView { if (!_tableView) { _tableView = [[CommonTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain cellHeight:80 cellRow:0 isAdaptive:NO isLine:NO commonCell:PPFriendTableViewCell.class createCell:^(ZZTableViewCell * _Nonnull cells, NSIndexPath * _Nonnull indexPath) { PPFriendTableViewCell *cell = (PPFriendTableViewCell *)cells; cell.msgModel = self.modelListArr[indexPath.row]; } selectedCell:^(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath) { } DidscrollView:^(UIScrollView * _Nonnull scrollView) { }]; _tableView.backgroundColor = UIColor.clearColor; _tableView.emptyDataSetSource = self; _tableView.emptyDataSetDelegate = self; } return _tableView; } - (void)getListModel { WEAKSELF [cUser.cDevice GetPPFriendWithSuccess:^(id responseObject) { [weakSelf.modelListArr removeAllObjects]; weakSelf.modelListArr = responseObject[@"ppFriendList"]; weakSelf.tableView.cellRow = weakSelf.modelListArr.count; [weakSelf.tableView reloadData]; } failure:^(NSError *error) { }]; } - (NSMutableArray *)modelListArr { if (!_modelListArr) _modelListArr = [NSMutableArray new]; return _modelListArr; } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end