// // SPSBChooseCityResultTableViewController.m // 我的社保 // // Created by shanp on 2021/5/20. // #import "SPSBChooseCityResultTableViewController.h" #import "SPSBUIGeneralHeader.h" @interface SPSBChooseCityResultTableViewController () @end @implementation SPSBChooseCityResultTableViewController - (instancetype)init { self = [super initWithStyle:UITableViewStylePlain backgroundColor:SPSBTableViewBackgroundColorWhite]; if (!self) return nil; return self; } - (void)viewDidLoad { [super viewDidLoad]; [self setupTableView]; } #pragma mark - Action #pragma mark - Network Action #pragma mark - Delegate & DataSource static NSString * const reuseIdentifier = @"Cell"; - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier]; if (!cell) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]; UILabel *label = [UILabel convenienceWithFont:spsb_font(16) text:nil textColor:spsb_333333_color()]; label.tag = 3000; [cell.contentView addSubview:label]; [label makeConstraints:^(JXHConstraintMaker *make) { make.leading.equalTo(15); make.centerY.equalTo(0); }]; //线 [cell.contentView createLineWithLocation:JXHLineLocationBottom headOffset:15 footOffset:0]; } if (_spsb_dataArray.count > indexPath.row) { UILabel *label = (UILabel *)[cell viewWithTag:3000]; if ([_spsb_dataArray[indexPath.row][@"city_name"] isKindOfClass:[NSString class]]) { label.text = _spsb_dataArray[indexPath.row][@"city_name"]; } else { label.text = @""; } } return cell; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return _spsb_dataArray.count; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { [tableView deselectRowAtIndexPath:indexPath animated:false]; NSString *cityId = _spsb_dataArray[indexPath.row][@"cid"]; _spsb_choose(cityId); } - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { jxh_endEdit(); } #pragma mark - UI - (void)setupTableView { self.tableView.rowHeight = 44.f; } @end