| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- //
- // EXFriendController.m
- // AIIM
- //
- // Created by gan on 2025/4/21.
- //
- #import <Foundation/Foundation.h>
- #import "EXFriendController.h"
- #import "FriendNetApi.h"
- #import "EXFriendListCell.h"
- @interface EXFriendController()<UITableViewDelegate,UITableViewDataSource,EXFriendListCellDelegate>
- @property (weak, nonatomic) IBOutlet UITableView *tableView;
- @property (nonatomic,strong) NSArray *friendlist;
- @end
- @implementation EXFriendController
- -(void)viewDidLoad{
- [super viewDidLoad];
- [self.navigationController setNavigationBarHidden:YES animated:NO];
- [_tableView registerClass:[EXFriendListCell class] forCellReuseIdentifier:@"friend"]; // 使用 Storyboard 时不需要这行代码,除非你混合使用 Storyboard 和代码配置 Cell。
- _tableView.delegate=self;
- _tableView.dataSource = self;
- _tableView.backgroundColor=[UIColor clearColor];
-
-
- [self getexfriends];
- }
- - (IBAction)gotoBack:(id)sender {
- NSLog(@"gotoBackgotoBackgotoBack");
- [self dismissViewControllerAnimated:YES completion:nil];
- }
- -(void)getexfriends{
- [FriendNetApi getvalidateList:nil succ:^(int code, NSDictionary * res) {
- NSLog(@"res:%@",res);
- self.friendlist = res[@"data"];
- if(self.friendlist){
- [self->_tableView reloadData];
- }
- } fail:^(NSError * _Nonnull error) {
- NSLog(@"error:%@",error);
- }];
- }
- -(void)actionNote:(NSString *)note{
- NSLog(@"note");
- [self getexfriends];
- }
- #pragma mark UITableViewDelegate
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- NSLog(@"numberOfRowsInSection:%lu",(unsigned long)self.friendlist.count);
- if(self.friendlist){
- return self.friendlist.count;
- }
- else{
- return 0;
- }
-
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- NSDictionary *data=self.friendlist[indexPath.row];
- NSLog(@"cellForRowAtIndexPath:%@",data);
- if(data){
-
- EXFriendListCell *cell =[tableView dequeueReusableCellWithIdentifier:@"friend" forIndexPath:indexPath];
- if(cell==nil){
- cell=[[EXFriendListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"friend"];
- }
- [cell fillWithData:data];
- cell.delegate = self;
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- cell.backgroundColor = [UIColor clearColor];
- return cell;
- }
- return nil;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return 70;
- }
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- NSLog(@"didSelectRowAtIndexPath:%@",indexPath);
-
-
- }
- @end
|