SPSBInputBankViewController.m 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // SPSBInputBankViewController.m
  3. // 我的社保
  4. //
  5. // Created by shanp on 2021/5/19.
  6. //
  7. #import "SPSBInputBankViewController.h"
  8. #import "SPSBUIGeneralHeader.h"
  9. #import "SPSBTextField.h"
  10. #import "SPSBVerificationProfile.h"
  11. #import "UIView+SPSBLoadingTipsView.h"
  12. @interface SPSBInputBankViewController () {
  13. SPSBTextField *_textField;
  14. }
  15. @end
  16. @implementation SPSBInputBankViewController
  17. - (void)viewDidLoad {
  18. [super viewDidLoad];
  19. [self setupUI];
  20. }
  21. #pragma mark - Action
  22. - (void)saveAction {
  23. jxh_endEdit();
  24. if (_textField.text.length < SPSBMinBankNameLength) {
  25. [self.view showToastWithTitle:@"请输入正确的银行名称"];
  26. return;
  27. }
  28. _spsb_completionAction(_textField.text);
  29. [self.navigationController popToViewController:self.navigationController.viewControllers[self.navigationController.viewControllers.count - 3] animated:true];
  30. }
  31. - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
  32. jxh_endEdit();
  33. }
  34. #pragma mark - Network Action
  35. #pragma mark - UI
  36. - (void)setupUI {
  37. self.view.backgroundColor = spsb_F5F5F5_color();
  38. self.title = @"银行卡";
  39. [self createRightButton];
  40. [self cerateTextField];
  41. }
  42. - (void)cerateTextField {
  43. UIView *view = UIView.new;
  44. view.backgroundColor = spsb_FFFFFF_color(1.f);
  45. [self.view addSubview:view];
  46. [view makeConstraints:^(JXHConstraintMaker *make) {
  47. make.top.equalTo(self.view.safetop).offset(12);
  48. make.leading.and.trailing.equalTo(0);
  49. make.height.equalTo(50);
  50. }];
  51. UILabel *titleLabel = [UILabel convenienceWithFont:spsb_font(16) text:@"开户银行" textColor:spsb_333333_color()];
  52. [view addSubview:titleLabel];
  53. [titleLabel makeConstraints:^(JXHConstraintMaker *make) {
  54. make.leading.equalTo(15);
  55. make.centerY.equalTo(0);
  56. }];
  57. _textField = [SPSBTextField convenienceWithFont:spsb_font(16) placeholder:@"请输入开户银行名称" placeholderColor:spsb_CCCCCC_color() textColor:spsb_666666_color() clearButtonMode:UITextFieldViewModeWhileEditing returnType:UIReturnKeyDone delegate:self];
  58. _textField.textAlignment = NSTextAlignmentRight;
  59. _textField.spsb_maxCount = SPSBMaxBankNumLength;
  60. [view addSubview:_textField];
  61. [_textField makeConstraints:^(JXHConstraintMaker *make) {
  62. make.leading.equalTo(135);
  63. make.trailing.equalTo(-15);
  64. make.top.and.bottom.equalTo(0);
  65. }];
  66. }
  67. - (void)createRightButton {
  68. UIButton *rightButton = [UIButton convenienceWithFont:spsb_font(15) target:self action:@selector(saveAction)];
  69. [rightButton setTitle:@"保存" titleColor:spsb_3296FB_color() state:JXHButtonControlStateNormal];
  70. rightButton.frame = CGRectMake(0, 0, 60, 44);
  71. [rightButton setContentHorizontalAlignment:UIControlContentHorizontalAlignmentRight];
  72. UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithCustomView:rightButton];
  73. self.navigationItem.rightBarButtonItem = rightItem;
  74. }
  75. @end