OrderDetailListViewController.m 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. //
  2. // OrderDetailListViewController.m
  3. // IBOSS
  4. //
  5. // Created by 关宏厚 on 2018/11/15.
  6. // Copyright © 2018 elongtian. All rights reserved.
  7. //
  8. #import "OrderDetailListViewController.h"
  9. @interface OrderDetailListViewController ()
  10. @end
  11. @implementation OrderDetailListViewController
  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 1591;
  38. }
  39. /**
  40. 有几组
  41. @param tableView tableView
  42. @return 组数
  43. */
  44. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  45. return _orderDetailArray.count;
  46. }
  47. /**
  48. 返回每个cell
  49. @param tableView tableView
  50. @param indexPath 组数,行数的封装
  51. @return 返回cell
  52. */
  53. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  54. static NSString *cellIdentifier = @"OrderDetailCell";
  55. OrderAuditDetailListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
  56. if (!cell) {
  57. cell = [[OrderAuditDetailListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
  58. }
  59. else
  60. //当页面拉动的时候 当cell存在并且最后一个存在 把它进行删除就出来一个独特的cell我们在进行数据配置即可避免
  61. {
  62. while ([cell.contentView.subviews lastObject] != nil) {
  63. [(UIView *)[cell.contentView.subviews lastObject] removeFromSuperview];
  64. }
  65. }
  66. OrderDetailModel *detailModel= _orderDetailArray[indexPath.section];
  67. [cell setOrderAuditDetailCell:detailModel];
  68. return cell;
  69. }
  70. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  71. {
  72. UIView *view = [[UIView alloc] init];
  73. view.backgroundColor = [UIColor clearColor];
  74. return view ;
  75. }
  76. /**
  77. tableview分区的间隔高度
  78. @param tableView <#tableView description#>
  79. @param section <#section description#>
  80. @return <#return value description#>
  81. */
  82. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  83. {
  84. return 10;
  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. {
  101. _orderDetailArray=detailArray;
  102. [_vTableView reloadData];
  103. }
  104. @end