MOGuildStartView.m 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //
  2. // MOGuildStartView.m
  3. // MiMoLive
  4. //
  5. // Created by SuperC on 2023/10/25.
  6. //
  7. #import "MOGuildStartView.h"
  8. #import "MOGuildStartCell.h"
  9. @implementation MOGuildStartView
  10. - (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style
  11. {
  12. self = [super initWithFrame:frame style:style];
  13. if (self)
  14. {
  15. self.delegate = self;
  16. self.dataSource = self;
  17. self.estimatedRowHeight = 0;
  18. self.estimatedSectionHeaderHeight = 0;
  19. self.estimatedSectionFooterHeight = 0;
  20. //iOS15适配
  21. if (@available(iOS 15.0, *))
  22. {
  23. self.sectionHeaderTopPadding = 0;
  24. }
  25. self.backgroundColor = [MOTools colorWithHexString:@"#F5F1F6" alpha:1.0];
  26. self.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
  27. [self registerNib:[UINib nibWithNibName:@"MOGuildStartCell" bundle:nil] forCellReuseIdentifier:MOGuildStartCell_ID];
  28. }
  29. return self;
  30. }
  31. - (void)setDataArr:(NSMutableArray *)dataArr{
  32. _dataArr = dataArr;
  33. [self reloadData];
  34. }
  35. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  36. {
  37. return self.dataArr.count;
  38. }
  39. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  40. {
  41. return 1;
  42. }
  43. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  44. MOGuildBase *model = self.dataArr[indexPath.section];
  45. MOGuildStartCell *cell = [tableView dequeueReusableCellWithIdentifier:MOGuildStartCell_ID];
  46. cell.model = model;
  47. return cell;
  48. }
  49. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  50. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  51. }
  52. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
  53. return 0.01;
  54. }
  55. - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
  56. return 10.0;
  57. }
  58. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
  59. UIView *view = [[UIView alloc] init];
  60. view.backgroundColor = [UIColor clearColor];
  61. return view;
  62. }
  63. - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
  64. UIView *view = [[UIView alloc] init];
  65. view.backgroundColor = [UIColor clearColor];
  66. return view;
  67. }
  68. @end