// // OrderFeesDetailListViewController.m // IBOSS // // Created by 关宏厚 on 2018/11/15. // Copyright © 2018 elongtian. All rights reserved. // #import "OrderFeesDetailListViewController.h" @interface OrderFeesDetailListViewController () @end @implementation OrderFeesDetailListViewController #pragma mark - 公共函数 /** 视图加载完成函数 */ - (void)viewDidLoad { [super viewDidLoad]; [self initUI]; } #pragma mark - 委托函数 /** 指定每一组有几行 @param tableView tableView @param section 第几组 @return 几行 */ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return 1; } /** 指定每个cell的高度 @param tableView tableView @param indexPath 组数,行数的封装 @return 每个cell的高度 */ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return 421; } /** 有几组 @param tableView tableView @return 组数 */ - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return _orderFeesDetailArray.count; } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { UIView *view = [[UIView alloc] init]; view.backgroundColor = [UIColor clearColor]; return view ; } /** tableview分区的间隔高度 @param tableView <#tableView description#> @param section <#section description#> @return <#return value description#> */ - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { return 10; } /** 返回每个cell @param tableView tableView @param indexPath 组数,行数的封装 @return 返回cell */ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *cellIdentifier = @"OrderFeesDetailCell"; OrderFeesDetailListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (!cell) { cell = [[OrderFeesDetailListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; } else //当页面拉动的时候 当cell存在并且最后一个存在 把它进行删除就出来一个独特的cell我们在进行数据配置即可避免 { while ([cell.contentView.subviews lastObject] != nil) { [(UIView *)[cell.contentView.subviews lastObject] removeFromSuperview]; } } OrderFeesDetailModel *detailModel= _orderFeesDetailArray[indexPath.section]; [cell setOrderFeesDetailCell:detailModel]; return cell; } #pragma mark - 私有函数 -(void)initUI { _vTableView = [[UITableView alloc] initWithFrame:CGRectMake(10, 10, self.view.frame.size.width-20, self.view.frame.size.height-100-rectStatusHeight-rectNavHeight)]; _vTableView.separatorStyle = UITableViewCellSeparatorStyleNone; _vTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight; _vTableView.delegate = self; _vTableView.dataSource=self; _vTableView.backgroundColor = [UIColor clearColor]; [self.view addSubview:_vTableView]; } -(void)loadData:(NSMutableArray*)detailArray{ _orderFeesDetailArray=detailArray; [_vTableView reloadData]; } @end