SPSBSafeCenterTableViewController.m 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //
  2. // SPSBSafeCenterTableViewController.m
  3. // 我的社保
  4. //
  5. // Created by shanp on 2021/5/22.
  6. //
  7. #import "SPSBSafeCenterTableViewController.h"
  8. #import "SPSBUIGeneralHeader.h"
  9. #import "SPSBHtmlViewController.h"
  10. #import "SPSBURLApiProfile.h"
  11. #import "SPSBSafeProblemsListViewController.h"
  12. #import "SPSBCancelAccountViewController.h"
  13. @interface SPSBSafeCenterTableViewController ()
  14. @end
  15. @implementation SPSBSafeCenterTableViewController
  16. - (instancetype)init {
  17. self = [super initWithStyle:UITableViewStylePlain backgroundColor:SPSBTableViewBackgroundColorGray];
  18. if (!self) return nil;
  19. return self;
  20. }
  21. - (void)viewDidLoad {
  22. [super viewDidLoad];
  23. [self setupUI];
  24. }
  25. #pragma mark - Action
  26. #pragma mark - Network Action
  27. #pragma mark - Delegate & DataSource
  28. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  29. UITableViewCell *cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
  30. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  31. NSArray *titleArray = @[@"注销帐号", @"常见问题", @"隐私政策"];
  32. UILabel *titleLabel = [UILabel convenienceWithFont:spsb_font(16) text:titleArray[indexPath.row] textColor:spsb_333333_color()];
  33. [cell.contentView addSubview:titleLabel];
  34. [titleLabel makeConstraints:^(JXHConstraintMaker *make) {
  35. make.leading.equalTo(15);
  36. make.centerY.equalTo(0);
  37. }];
  38. UIImageView *arrow = [[UIImageView alloc] initWithImage:jxh_getImage(list_arrow)];
  39. [cell.contentView addSubview:arrow];
  40. [arrow makeConstraints:^(JXHConstraintMaker *make) {
  41. make.trailing.equalTo(-15);
  42. make.centerY.equalTo(0);
  43. }];
  44. if (indexPath.row > 0) {
  45. [cell.contentView createLineWithLocation:JXHLineLocationTop headOffset:15 footOffset:0];
  46. }
  47. return cell;
  48. }
  49. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  50. return 3;
  51. }
  52. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  53. [tableView deselectRowAtIndexPath:indexPath animated:false];
  54. switch (indexPath.row) {
  55. case 0:
  56. [self.navigationController pushViewController:SPSBCancelAccountViewController.new animated:true];
  57. break;
  58. case 1:
  59. [self.navigationController pushViewController:SPSBSafeProblemsListViewController.new animated:true];
  60. break;
  61. case 2: {
  62. SPSBHtmlViewController *vc = SPSBHtmlViewController.new;
  63. vc.spsb_url = SPSBSocialSecurityPrivacyLink;
  64. [self.navigationController pushViewController:vc animated:true];
  65. }
  66. break;
  67. default:
  68. break;
  69. }
  70. }
  71. #pragma mark - UI
  72. - (void)setupUI {
  73. self.title = @"安全中心";
  74. [self setupTableView];
  75. }
  76. - (void)setupTableView {
  77. self.tableView.rowHeight = 50.f;
  78. self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:(CGRect){0, 0, jxh_screenWidth(), 12}];
  79. }
  80. @end