123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- //
- // CYSelFriendyListView.m
- // shiku_im
- //
- // Created by Ron on 2019/11/24.
- // Copyright © 2019 Reese. All rights reserved.
- //
- #import "CYSelFriendyListView.h"
- #import "CYManager.h"
- #import "CYModel.h"
- #import "JXCell.h"
- #import "CYFriendyTableViewCell.h"
- @interface CYSelFriendyListView()<UITableViewDelegate,UITableViewDataSource>
- @property (nonatomic,strong)UITableView *tableView;
- @end
- @implementation CYSelFriendyListView
- //
- //- (instancetype)init
- //{
- // self = [super init];
- // if (self) {
- // [self creatUI];
- // }
- // return self;
- //}
- -(void)viewDidLoad{
- [self creatUI];
- }
- -(void)creatUI{
-
- UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
- tableView.delegate = self;
- tableView.dataSource = self;
- // [tableView ]
- tableView.backgroundColor = [UIColor whiteColor];
- tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- tableView.sectionIndexColor = [UIColor grayColor]; //修改右边索引字体的颜色
- tableView.sectionIndexBackgroundColor = [UIColor clearColor];
- [tableView setAutoresizesSubviews:YES];
- [tableView setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
- tableView.estimatedRowHeight = 0;
- tableView.estimatedSectionFooterHeight = 0;
- tableView.estimatedSectionHeaderHeight = 0;
- // [tableView registerNib:[NSBundle mainBundle] forCellReuseIdentifier:@"CYSelFriendyListViewCell"];
- // [tableView registerClass:[JXCell class] forCellReuseIdentifier:@"CYSelFriendyListViewCell"];
- _tableView = tableView;
- [self.view addSubview:_tableView];
-
- }
- -(void)viewDidAppear:(BOOL)animated{
- [super viewDidAppear:YES];
- [self.tableView reloadData];
- }
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
-
- return 1;
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
-
- return CYManager.sharedManager.getModel.selFriendyIdArr.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- CYFriendyTableViewCell *cell=nil;
- NSString* cellName = [NSString stringWithFormat:@"selCYVC_%d",(int)indexPath.row];
-
- CYModel *model = CYManager.sharedManager.getModel;
-
- cell = [[CYFriendyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellName];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- cell.title = model.selFriendyNameArr[indexPath.row];
- cell.userId = model.selFriendyIdArr[indexPath.row];
- [cell headImageViewImageWithUserId:model.selFriendyIdArr[indexPath.row] roomId:model.selFriendyIdArr[indexPath.row]];
-
- return cell;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- return 64;
- }
- -(void)reloadData{
- [_tableView reloadData];
- }
- /*
- // Only override drawRect: if you perform custom drawing.
- // An empty implementation adversely affects performance during animation.
- - (void)drawRect:(CGRect)rect {
- // Drawing code
- }
- */
- @end
|