CYSelFriendyListView.m 3.0 KB

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