// // CYFriendAndGroupListView.m // shiku_im // // Created by Ron on 2019/11/23. // Copyright © 2019 Reese. All rights reserved. // #import "CYSelGroupListView.h" #import "CYManager.h" #import "CYModel.h" #import "JXCell.h" @interface CYSelGroupListView() @property (nonatomic,strong)UITableView *tableView; @end @implementation CYSelGroupListView //- (instancetype)init //{ // self = [super init]; // if (self) { //// [self addSubview:<#(nonnull UIView *)#>] // [self creatUI]; // } // return self; //} -(void)viewDidLoad{ [self creatUI]; } -(void)viewDidAppear:(BOOL)animated{ [super viewDidAppear:YES]; [self.tableView reloadData]; } -(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 = tableView; [self.view addSubview:_tableView]; } -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return CYManager.sharedManager.getModel.selGroupIdArr.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { JXCell *cell=nil; NSString* cellName = [NSString stringWithFormat:@"selVC_%d",(int)indexPath.row]; CYModel *model = CYManager.sharedManager.getModel; cell = [[JXCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellName]; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.title = model.selGroupNameArr[indexPath.row]; cell.userId = model.selGroupIdArr[indexPath.row]; [cell headImageViewImageWithUserId:model.selGroupIdArr[indexPath.row] roomId:model.selGroupIdArr[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