| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- //
- // RAOrderDetailViewController+TableViewDataSource.m
- // Apex And Drivers
- //
- // Created by Jack on 2018/6/2.
- // Copyright © 2018年 USAI. All rights reserved.
- //
- #import "RAOrderDetailViewController+TableViewDataSource.h"
- #import "RADetailBaseModel.h"
- #import "RADetailSingleLineModel.h"
- #import "RADetailMultLineModel.h"
- #import "RADetailLocationModel.h"
- #import "RADetailActionCollectionModel.h"
- #import "RADetailSingleLineCell.h"
- #import "RADetailMultLineCell.h"
- #import "RADetailActionsCell.h"
- #import "RADetailLocationCell.h"
- @implementation RAOrderDetailViewController (TableViewDataSource)
- - (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
-
- RADetailBaseModel *model = [self modelForIndexPath:indexPath];
- RAOrderDetailValueType type = model.type;
- switch (type) {
- case RAOrderDetailValueTypeSingleLine: {
- RADetailSingleLineModel *singleModel = (RADetailSingleLineModel *)model;
- RADetailSingleLineCell *cell = [tableView dequeueReusableCellWithIdentifier:@"RADetailSingleLineCell" forIndexPath:indexPath];
- [cell setModel:singleModel];
- return cell;
- }
- break;
- case RAOrderDetailValueTypeMultipleLine: {
- RADetailMultLineModel *multModel = (RADetailMultLineModel *)model;
- RADetailMultLineCell *cell = [tableView dequeueReusableCellWithIdentifier:@"RADetailMultLineCell" forIndexPath:indexPath];
- [cell setModel:multModel];
- return cell;
- }
- break;
- case RAOrderDetailValueTypeAction: {
- RADetailActionCollectionModel *actionModel = (RADetailActionCollectionModel *)model;
- RADetailActionsCell *cell = [tableView dequeueReusableCellWithIdentifier:@"RADetailActionsCell" forIndexPath:indexPath];
- cell.actionLayout.delegate = actionModel;
- [cell setModel:actionModel];
- return cell;
- }
- break;
- case RAOrderDetailValueTypeLocation: {
- RADetailLocationModel *locationModel = (RADetailLocationModel *)model;
- RADetailLocationCell *cell = [tableView dequeueReusableCellWithIdentifier:@"RADetailLocationCell" forIndexPath:indexPath];
- [cell setModel:locationModel];
- return cell;
- }
- break;
-
- default:
- break;
- }
-
- UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"detaulCell"];
- return cell;
- }
- - (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return [self numberOfItemForSection:section];
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- return [self sectionNumber];
- }
- @end
|