123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- //
- // SPSBChooseBankTableViewController.m
- // 我的社保
- //
- // Created by shanp on 2021/5/19.
- //
- #import "SPSBChooseBankTableViewController.h"
- #import "SPSBUIGeneralHeader.h"
- #import "SPSBBusinessManager.h"
- #import "SPSBInputBankViewController.h"
- @interface SPSBChooseBankTableViewController (){
- NSArray *_dataArray;
- UIView *_footView;
- }
- @end
- @implementation SPSBChooseBankTableViewController
- - (instancetype)init {
- self = [super initWithStyle:UITableViewStyleGrouped backgroundColor:SPSBTableViewBackgroundColorGray];
- if (!self) return nil;
- return self;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self initData];
- [self setupUI];
- }
- - (void)initData {
- _dataArray = spsb_bankArray();
- }
- #pragma mark - Action
- - (void)footAction {
- SPSBInputBankViewController *vc = SPSBInputBankViewController.new;
- vc.spsb_completionAction = _spsb_completionAction;
- [self.navigationController pushViewController:vc animated:true];
- }
- #pragma mark - Network Action
- #pragma mark - Delegate & DataSource
- static NSString * const reuseIdentifier = @"SPSBChooseBankTableViewCell";
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
- if (!cell) {
- cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
-
- UIImageView *icon = UIImageView.new;
- icon.tag = 3000;
- [cell.contentView addSubview:icon];
- [icon makeConstraints:^(JXHConstraintMaker *make) {
- make.leading.equalTo(20);
- make.centerY.equalTo(0);
- }];
-
- UILabel *label = [UILabel convenienceWithFont:spsb_font(16) text:@"" textColor:spsb_333333_color()];
- label.tag = 3001;
- [cell.contentView addSubview:label];
- [label makeConstraints:^(JXHConstraintMaker *make) {
- make.leading.equalTo(60);
- make.centerY.equalTo(cell.contentView);
- }];
-
- [cell.contentView createLineWithLocation:JXHLineLocationBottom headOffset:20 footOffset:0];
- }
-
- UIImageView *icon = [cell.contentView viewWithTag:3000];
- UILabel *label = [cell.contentView viewWithTag:3001];
- label.text = _dataArray[indexPath.row];
- icon.image = [UIImage imageNamed:spsb_bankIconDictionary()[label.text]];
- return cell;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return _dataArray.count;
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- [tableView deselectRowAtIndexPath:indexPath animated:false];
- _spsb_completionAction(_dataArray[indexPath.row]);
- [self.navigationController popViewControllerAnimated:true];
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
- return 12;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
- return UIView.new;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
- return 150;
- }
- - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
- if (!_footView) {
- _footView = UIView.new;
-
- UIButton *footButton = [UIButton convenienceWithTarget:self action:@selector(footAction)];
- footButton.backgroundColor = spsb_FFFFFF_color(1.f);
- [_footView addSubview:footButton];
- [footButton makeConstraints:^(JXHConstraintMaker *make) {
- make.top.and.leading.and.trailing.equalTo(0);
- make.height.equalTo(50);
- }];
- UILabel *label = [UILabel convenienceWithFont:spsb_font(16) text:@"其他银行" textColor:spsb_333333_color()];
- [footButton addSubview:label];
- [label makeConstraints:^(JXHConstraintMaker *make) {
- make.leading.equalTo(20);
- make.centerY.equalTo(0);
- }];
- }
- return _footView;
- }
- #pragma mark - UI
- - (void)setupUI {
- self.title = @"选择银行";
- [self setupTableView];
- }
- - (void)setupTableView {
- self.tableView.rowHeight = 50.f;
- }
- @end
|