123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- //
- // SPSBTransferImformationView.m
- // 我的社保
- //
- // Created by shanp on 2021/6/4.
- //
- #import "SPSBTransferImformationView.h"
- #import "SPSBUIGeneralHeader.h"
- #import "SPSBTextField.h"
- #import "SPSBVerificationProfile.h"
- #import "SPSBTitleAndContentTableViewCell.h"
- @interface SPSBTransferImformationView ()<UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate> {
- SPSBTextField *_nameTextField;
- SPSBTextField *_remarksTextField;
- }
- @end
- @implementation SPSBTransferImformationView
- - (instancetype)init {
- self = [super initWithFrame:CGRectZero style:UITableViewStylePlain];
- if (!self) return nil;
- [self setupTableView];
- return self;
- }
- #pragma mark - Action
- - (NSString *)spsb_name {
- NSString *name = _nameTextField.text;
- if (!name) {
- name = @"";
- }
- return name;
- }
- - (NSString *)spsb_remark {
- NSString *remark = _remarksTextField.text;
- if (!remark) {
- remark = @"";
- }
- return remark;
- }
- #pragma mark - UITextFieldDelegate
- - (BOOL)textFieldShouldReturn:(UITextField *)textField {
- jxh_endEdit();
- return true;
- }
- #pragma mark - Delegate & DataSource
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- NSArray *titleArray = @[@"转移项目", @"办理人", @"转出城市", @"", @"转入城市", @"", @"说明"];
- if (indexPath.section < 3 && indexPath.row == 0) {
- SPSBTitleAndContentTableViewCell *cell = [SPSBTitleAndContentTableViewCell createSelectCellWithTitle:titleArray[indexPath.section * 2 + indexPath.row] content:_spsb_data[indexPath.section * 2 + indexPath.row]];
- if ([_spsb_data[indexPath.section * 2 + indexPath.row] isEqualToString:@"请选择"]) {
- cell.spsb_contentLabel.textColor = spsb_CCCCCC_color();
- } else {
- cell.spsb_contentLabel.textColor = spsb_666666_color();
- }
-
- return cell;
- } else {
- SPSBTitleAndContentTableViewCell *cell = [SPSBTitleAndContentTableViewCell createSingleDisplayTitleCellWithTitle:titleArray[indexPath.section * 2 + indexPath.row]];
- cell.userInteractionEnabled = true;
- if (indexPath.section == 0) {
- [cell.contentView addSubview:_nameTextField];
- [_nameTextField makeConstraints:^(JXHConstraintMaker *make) {
- make.trailing.equalTo(-15);
- make.centerY.equalTo(0);
- make.leading.equalTo(100);
- }];
- } else {
- [cell.contentView addSubview:_remarksTextField];
- [_remarksTextField makeConstraints:^(JXHConstraintMaker *make) {
- make.trailing.equalTo(-15);
- make.centerY.equalTo(0);
- make.leading.equalTo(100);
- }];
- [cell.spsb_bottomLine makeConstraints:^(JXHConstraintMaker *make) {
- make.leading.update(0);
- }];
- }
- return cell;
- }
- return [[UITableViewCell alloc] init];
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- return _spsb_sectionNumberArray.count;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return [_spsb_sectionNumberArray[section] floatValue];
- }
- - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
- [tableView deselectRowAtIndexPath:indexPath animated:false];
- if (_spsb_selectRow) {
- _spsb_selectRow(indexPath);
- }
- }
- #pragma mark - UI
- - (void)setupTableView {
- self.rowHeight = 50;
- self.delaysContentTouches = false;
- self.backgroundColor = spsb_F5F5F5_color();
- self.separatorStyle = UITableViewCellSeparatorStyleNone;
- self.showsHorizontalScrollIndicator = false;
- self.showsVerticalScrollIndicator = false;
- self.delegate = self;
- self.dataSource = self;
- self.scrollEnabled = false;
- self.tableFooterView = [[UIView alloc] initWithFrame:(CGRect){0, 0, jxh_screenWidth(), 10}];
-
- _nameTextField = [self creatTextFieldWithPlaceholder:@"请输入办理人姓名" maxCount:SPSBMaxNameLength];
- _remarksTextField = [self creatTextFieldWithPlaceholder:@"请输入说明信息" maxCount:50];
- }
- - (SPSBTextField *)creatTextFieldWithPlaceholder:(NSString *)placeholder maxCount:(NSInteger)maxCount {
- SPSBTextField *textField = [SPSBTextField convenienceWithFont:spsb_font(15) placeholder:placeholder placeholderColor:spsb_CCCCCC_color() textColor:spsb_666666_color() clearButtonMode:UITextFieldViewModeWhileEditing returnType:UIReturnKeyDone delegate:self];
- textField.textAlignment = NSTextAlignmentRight;
- textField.spsb_maxCount = maxCount;
- return textField;
- }
- - (BOOL)touchesShouldCancelInContentView:(UIView *)view {
- [super touchesShouldCancelInContentView:view];
- return true;
- }
- @end
|