CYSelGroupListView.m 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. //
  2. // CYFriendAndGroupListView.m
  3. // shiku_im
  4. //
  5. // Created by Ron on 2019/11/23.
  6. // Copyright © 2019 Reese. All rights reserved.
  7. //
  8. #import "CYSelGroupListView.h"
  9. #import "CYManager.h"
  10. #import "CYModel.h"
  11. #import "JXCell.h"
  12. @interface CYSelGroupListView()<UITableViewDelegate,UITableViewDataSource>
  13. @property (nonatomic,strong)UITableView *tableView;
  14. @end
  15. @implementation CYSelGroupListView
  16. //- (instancetype)init
  17. //{
  18. // self = [super init];
  19. // if (self) {
  20. //// [self addSubview:<#(nonnull UIView *)#>]
  21. // [self creatUI];
  22. // }
  23. // return self;
  24. //}
  25. -(void)viewDidLoad{
  26. [self creatUI];
  27. }
  28. -(void)viewDidAppear:(BOOL)animated{
  29. [super viewDidAppear:YES];
  30. [self.tableView reloadData];
  31. }
  32. -(void)creatUI{
  33. UITableView *tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
  34. tableView.delegate = self;
  35. tableView.dataSource = self;
  36. // [tableView ]
  37. tableView.backgroundColor = [UIColor whiteColor];
  38. tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  39. tableView.sectionIndexColor = [UIColor grayColor]; //修改右边索引字体的颜色
  40. tableView.sectionIndexBackgroundColor = [UIColor clearColor];
  41. [tableView setAutoresizesSubviews:YES];
  42. [tableView setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
  43. tableView.estimatedRowHeight = 0;
  44. tableView.estimatedSectionFooterHeight = 0;
  45. tableView.estimatedSectionHeaderHeight = 0;
  46. _tableView = tableView;
  47. [self.view addSubview:_tableView];
  48. }
  49. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  50. return 1;
  51. }
  52. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  53. return CYManager.sharedManager.getModel.selGroupIdArr.count;
  54. }
  55. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  56. {
  57. JXCell *cell=nil;
  58. NSString* cellName = [NSString stringWithFormat:@"selVC_%d",(int)indexPath.row];
  59. CYModel *model = CYManager.sharedManager.getModel;
  60. cell = [[JXCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellName];
  61. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  62. cell.title = model.selGroupNameArr[indexPath.row];
  63. cell.userId = model.selGroupIdArr[indexPath.row];
  64. [cell headImageViewImageWithUserId:model.selGroupIdArr[indexPath.row] roomId:model.selGroupIdArr[indexPath.row]];
  65. return cell;
  66. }
  67. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  68. {
  69. return 64;
  70. }
  71. -(void)reloadData{
  72. [_tableView reloadData];
  73. }
  74. /*
  75. // Only override drawRect: if you perform custom drawing.
  76. // An empty implementation adversely affects performance during animation.
  77. - (void)drawRect:(CGRect)rect {
  78. // Drawing code
  79. }
  80. */
  81. @end