94 lines
3.2 KiB
Mathematica
94 lines
3.2 KiB
Mathematica
![]() |
//
|
||
|
// XPMineFriendViewController.m
|
||
|
// xplan-ios
|
||
|
//
|
||
|
// Created by 冯硕 on 2021/12/21.
|
||
|
//
|
||
|
|
||
|
#import "XPMineFriendViewController.h"
|
||
|
///Third
|
||
|
#import <Masonry/Masonry.h>
|
||
|
#import <MJRefresh/MJRefresh.h>
|
||
|
#import <NIMSDK/NIMSDK.h>
|
||
|
///Tool
|
||
|
#import "ThemeColor.h"
|
||
|
///View
|
||
|
#import "XPMineFriendEmptyTableViewCell.h"
|
||
|
#import "XPMineFriendTableViewCell.h"
|
||
|
|
||
|
@interface XPMineFriendViewController ()<UITableViewDelegate,UITableViewDataSource>
|
||
|
///列表
|
||
|
@property (nonatomic,strong) UITableView *tableView;
|
||
|
///数据源
|
||
|
@property (nonatomic,strong) NSArray *datasource;
|
||
|
///当前页数
|
||
|
@property (nonatomic,assign) int page;
|
||
|
///更多数据
|
||
|
@property (nonatomic,assign) BOOL hasNoMoreData;
|
||
|
@end
|
||
|
|
||
|
@implementation XPMineFriendViewController
|
||
|
|
||
|
- (void)viewDidLoad {
|
||
|
[super viewDidLoad];
|
||
|
self.datasource = [[NIMSDK sharedSDK].userManager myFriends];
|
||
|
[self initSubViews];
|
||
|
[self initSubViewConstraints];
|
||
|
}
|
||
|
#pragma mark - Private Method
|
||
|
- (void)initSubViews {
|
||
|
[self.view addSubview:self.tableView];
|
||
|
}
|
||
|
|
||
|
- (void)initSubViewConstraints {
|
||
|
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.edges.mas_equalTo(self.view);
|
||
|
}];
|
||
|
}
|
||
|
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
||
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||
|
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||
|
}
|
||
|
|
||
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||
|
if (self.datasource.count > 0) {
|
||
|
XPMineFriendTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineFriendTableViewCell class])];
|
||
|
if (cell == nil) {
|
||
|
cell = [[XPMineFriendTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineFriendTableViewCell class])];
|
||
|
}
|
||
|
return cell;
|
||
|
}
|
||
|
|
||
|
XPMineFriendEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineFriendEmptyTableViewCell class])];
|
||
|
if (cell == nil) {
|
||
|
cell = [[XPMineFriendEmptyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineFriendEmptyTableViewCell class])];
|
||
|
}
|
||
|
cell.emptyTitle = @"您还没有任何好友";
|
||
|
return cell;
|
||
|
}
|
||
|
|
||
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||
|
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||
|
}
|
||
|
|
||
|
#pragma mark - Getters And Setters
|
||
|
|
||
|
- (UITableView *)tableView {
|
||
|
if (!_tableView) {
|
||
|
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||
|
_tableView.delegate = self;
|
||
|
_tableView.dataSource = self;
|
||
|
_tableView.tableFooterView = [UIView new];
|
||
|
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||
|
_tableView.backgroundColor = [UIColor clearColor];
|
||
|
_tableView.rowHeight = 65;
|
||
|
if (@available(iOS 11.0, *)) {
|
||
|
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||
|
}
|
||
|
[_tableView registerClass:[XPMineFriendEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineFriendEmptyTableViewCell class])];
|
||
|
[_tableView registerClass:[XPMineFriendTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineFriendTableViewCell class])];
|
||
|
}
|
||
|
return _tableView;
|
||
|
}
|
||
|
@end
|