OrderFeesDetailListViewController.m 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. //
  2. // OrderFeesDetailListViewController.m
  3. // IBOSS
  4. //
  5. // Created by 关宏厚 on 2018/11/15.
  6. // Copyright © 2018 elongtian. All rights reserved.
  7. //
  8. #import "OrderFeesDetailListViewController.h"
  9. @interface OrderFeesDetailListViewController ()
  10. @end
  11. @implementation OrderFeesDetailListViewController
  12. #pragma mark - 公共函数
  13. /**
  14. 视图加载完成函数
  15. */
  16. - (void)viewDidLoad {
  17. [super viewDidLoad];
  18. [self initUI];
  19. }
  20. #pragma mark - 委托函数
  21. /**
  22. 指定每一组有几行
  23. @param tableView tableView
  24. @param section 第几组
  25. @return 几行
  26. */
  27. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  28. return 1;
  29. }
  30. /**
  31. 指定每个cell的高度
  32. @param tableView tableView
  33. @param indexPath 组数,行数的封装
  34. @return 每个cell的高度
  35. */
  36. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  37. return 421;
  38. }
  39. /**
  40. 有几组
  41. @param tableView tableView
  42. @return 组数
  43. */
  44. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  45. return _orderFeesDetailArray.count;
  46. }
  47. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  48. {
  49. UIView *view = [[UIView alloc] init];
  50. view.backgroundColor = [UIColor clearColor];
  51. return view ;
  52. }
  53. /**
  54. tableview分区的间隔高度
  55. @param tableView <#tableView description#>
  56. @param section <#section description#>
  57. @return <#return value description#>
  58. */
  59. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  60. {
  61. return 10;
  62. }
  63. /**
  64. 返回每个cell
  65. @param tableView tableView
  66. @param indexPath 组数,行数的封装
  67. @return 返回cell
  68. */
  69. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  70. static NSString *cellIdentifier = @"OrderFeesDetailCell";
  71. OrderFeesDetailListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
  72. if (!cell) {
  73. cell = [[OrderFeesDetailListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
  74. }
  75. else
  76. //当页面拉动的时候 当cell存在并且最后一个存在 把它进行删除就出来一个独特的cell我们在进行数据配置即可避免
  77. {
  78. while ([cell.contentView.subviews lastObject] != nil) {
  79. [(UIView *)[cell.contentView.subviews lastObject] removeFromSuperview];
  80. }
  81. }
  82. OrderFeesDetailModel *detailModel= _orderFeesDetailArray[indexPath.section];
  83. [cell setOrderFeesDetailCell:detailModel];
  84. return cell;
  85. }
  86. #pragma mark - 私有函数
  87. -(void)initUI
  88. {
  89. _vTableView = [[UITableView alloc]
  90. initWithFrame:CGRectMake(10, 10, self.view.frame.size.width-20,
  91. self.view.frame.size.height-100-rectStatusHeight-rectNavHeight)];
  92. _vTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  93. _vTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
  94. _vTableView.delegate = self;
  95. _vTableView.dataSource=self;
  96. _vTableView.backgroundColor = [UIColor clearColor];
  97. [self.view addSubview:_vTableView];
  98. }
  99. -(void)loadData:(NSMutableArray*)detailArray{
  100. _orderFeesDetailArray=detailArray;
  101. [_vTableView reloadData];
  102. }
  103. @end