| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- //
- // RASettingViewController+TableDelegate.m
- // Apex And Drivers
- //
- // Created by Jack on 2018/9/12.
- // Copyright © 2018年 USAI. All rights reserved.
- //
- #import "RASettingViewController+TableDelegate.h"
- #import "RASettingSectionModel.h"
- #import "RASettingOptionModel.h"
- #import "RASettingSwitchModel.h"
- #import "RASettingActionModel.h"
- #import "RAOptionViewController.h"
- @implementation RASettingViewController (TableDelegate)
- - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
- return 60.0f;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
- return 30.0f;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
- return [UIView new];
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
-
- RASettingSectionModel *sectionModel = [self.sections objectAtIndex:indexPath.section];
- RASettingBaseModel *model = [sectionModel.settings objectAtIndex:indexPath.row];
-
- switch (model.type) {
- case RASettingTypeOption: {
-
- RASettingOptionModel *optionModel = (RASettingOptionModel *)model;
- [self showOption:optionModel];
- }
- break;
- case RASettingTypeSwitch: {
-
- }
- break;
- case RASettingTypeAction: {
- RASettingActionModel *actionModel = (RASettingActionModel *)model;
- switch (actionModel.actionType) {
- case RASettingActionTypeCleanCache: {
-
- }
- break;
-
- default:
- break;
- }
- }
- break;
- default: {
- }
- break;
- }
-
- }
- #pragma mark - Show Option
- - (void)showOption:(RASettingOptionModel *)model {
-
- if (!model) {
- return;
- }
-
- RAOptionViewController *optionVC = [RAOptionViewController optionViewControllerWith:model.options selectedIndex:model.selectedIndex];
- optionVC.optionTitle = model.title;
-
- [self.navigationController pushViewController:optionVC animated:YES];
- }
- @end
|