RAHomeViewController+HomeTableDelegate.m 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // RAHomeViewController+HomeTableDelegate.m
  3. // Apex And Drivers
  4. //
  5. // Created by Jack on 2018/6/1.
  6. // Copyright © 2018年 USAI. All rights reserved.
  7. //
  8. #import "RAHomeViewController+HomeTableDelegate.h"
  9. #import "RAHomeOrderModel.h"
  10. #import "RABadgeNumberView.h"
  11. #import "RAHomeSectionHeaderView.h"
  12. @implementation RAHomeViewController (HomeTableDelegate)
  13. #pragma mark - TableView Delegate
  14. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  15. return 140.0f;
  16. }
  17. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
  18. RAHomeSectionHeaderView *header = [RAHomeSectionHeaderView homeSectionHeader];
  19. RAHomeSectionModel *model = [self modelForSection:section];
  20. header.model = model;
  21. [header addMoreClickTarget:self selector:@selector(sectionExpandSwithBtnClick:)];
  22. return header;
  23. }
  24. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
  25. return 44.f;
  26. }
  27. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  28. RAHomeOrderModel *order = [self orderModelForIndexPath:indexPath];
  29. if (order.backendFlag) {
  30. order.backendFlag = !order.backendFlag;
  31. [self decreaseBackendFlagCountForSection:indexPath.section];
  32. }
  33. self.currentOrderID = order.orderID;
  34. [self pushDetailViewControllerForModel:order];
  35. }
  36. #pragma mark - Action
  37. - (void)sectionExpandSwithBtnClick:(UIButton *)sender {
  38. [self showMoreOrderForSection:sender.tag - TagBase];
  39. }
  40. @end