RASettingViewController+TableDelegate.m 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //
  2. // RASettingViewController+TableDelegate.m
  3. // Apex And Drivers
  4. //
  5. // Created by Jack on 2018/9/12.
  6. // Copyright © 2018年 USAI. All rights reserved.
  7. //
  8. #import "RASettingViewController+TableDelegate.h"
  9. #import "RASettingSectionModel.h"
  10. #import "RASettingOptionModel.h"
  11. #import "RASettingSwitchModel.h"
  12. #import "RASettingActionModel.h"
  13. #import "RAOptionViewController.h"
  14. @implementation RASettingViewController (TableDelegate)
  15. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  16. return 60.0f;
  17. }
  18. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
  19. return 30.0f;
  20. }
  21. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
  22. return [UIView new];
  23. }
  24. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  25. RASettingSectionModel *sectionModel = [self.sections objectAtIndex:indexPath.section];
  26. RASettingBaseModel *model = [sectionModel.settings objectAtIndex:indexPath.row];
  27. switch (model.type) {
  28. case RASettingTypeOption: {
  29. RASettingOptionModel *optionModel = (RASettingOptionModel *)model;
  30. [self showOption:optionModel];
  31. }
  32. break;
  33. case RASettingTypeSwitch: {
  34. }
  35. break;
  36. case RASettingTypeAction: {
  37. RASettingActionModel *actionModel = (RASettingActionModel *)model;
  38. switch (actionModel.actionType) {
  39. case RASettingActionTypeCleanCache: {
  40. }
  41. break;
  42. default:
  43. break;
  44. }
  45. }
  46. break;
  47. default: {
  48. }
  49. break;
  50. }
  51. }
  52. #pragma mark - Show Option
  53. - (void)showOption:(RASettingOptionModel *)model {
  54. if (!model) {
  55. return;
  56. }
  57. RAOptionViewController *optionVC = [RAOptionViewController optionViewControllerWith:model.options selectedIndex:model.selectedIndex];
  58. optionVC.optionTitle = model.title;
  59. [self.navigationController pushViewController:optionVC animated:YES];
  60. }
  61. @end