// // SPSBSafeCenterTableViewController.m // 我的社保 // // Created by shanp on 2021/5/22. // #import "SPSBSafeCenterTableViewController.h" #import "SPSBUIGeneralHeader.h" #import "SPSBHtmlViewController.h" #import "SPSBURLApiProfile.h" #import "SPSBSafeProblemsListViewController.h" #import "SPSBCancelAccountViewController.h" @interface SPSBSafeCenterTableViewController () @end @implementation SPSBSafeCenterTableViewController - (instancetype)init { self = [super initWithStyle:UITableViewStylePlain backgroundColor:SPSBTableViewBackgroundColorGray]; if (!self) return nil; return self; } - (void)viewDidLoad { [super viewDidLoad]; [self setupUI]; } #pragma mark - Action #pragma mark - Network Action #pragma mark - Delegate & DataSource - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil]; cell.selectionStyle = UITableViewCellSelectionStyleNone; NSArray *titleArray = @[@"注销帐号", @"常见问题", @"隐私政策"]; UILabel *titleLabel = [UILabel convenienceWithFont:spsb_font(16) text:titleArray[indexPath.row] textColor:spsb_333333_color()]; [cell.contentView addSubview:titleLabel]; [titleLabel makeConstraints:^(JXHConstraintMaker *make) { make.leading.equalTo(15); make.centerY.equalTo(0); }]; UIImageView *arrow = [[UIImageView alloc] initWithImage:jxh_getImage(list_arrow)]; [cell.contentView addSubview:arrow]; [arrow makeConstraints:^(JXHConstraintMaker *make) { make.trailing.equalTo(-15); make.centerY.equalTo(0); }]; if (indexPath.row > 0) { [cell.contentView createLineWithLocation:JXHLineLocationTop headOffset:15 footOffset:0]; } return cell; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 3; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:false]; switch (indexPath.row) { case 0: [self.navigationController pushViewController:SPSBCancelAccountViewController.new animated:true]; break; case 1: [self.navigationController pushViewController:SPSBSafeProblemsListViewController.new animated:true]; break; case 2: { SPSBHtmlViewController *vc = SPSBHtmlViewController.new; vc.spsb_url = SPSBSocialSecurityPrivacyLink; [self.navigationController pushViewController:vc animated:true]; } break; default: break; } } #pragma mark - UI - (void)setupUI { self.title = @"安全中心"; [self setupTableView]; } - (void)setupTableView { self.tableView.rowHeight = 50.f; self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:(CGRect){0, 0, jxh_screenWidth(), 12}]; } @end