SettlementMethodVC.m 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. //
  2. // SettlementMethodVC.m
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2018/4/8.
  6. // Copyright © 2018年 elongtian. All rights reserved.
  7. //
  8. #import "SettlementMethodVC.h"
  9. #import "SettlementMethodCell.h"
  10. @interface SettlementMethodVC ()
  11. @end
  12. @implementation SettlementMethodVC
  13. - (void)viewDidLoad {
  14. [super viewDidLoad];
  15. [self loadNavStyle];
  16. [self initUI];
  17. }
  18. /**
  19. 修改:2017-9-25
  20. 适配机型
  21. 安全区视图发生变化
  22. */
  23. -(void)viewSafeAreaInsetsDidChange{
  24. self.view.backgroundColor = [UIColor whiteColor];
  25. _vTableView.frame = CGRectMake(0,0, self.view.frame.size.width, self.view.safeAreaLayoutGuide.layoutFrame.size.height );
  26. [super viewSafeAreaInsetsDidChange];
  27. }
  28. -(void)loadNavStyle
  29. {
  30. self.navigationItem.title=@"请选择";
  31. //返回
  32. UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
  33. [button setBackgroundImage:[UIImage imageNamed:@"icon_back"]
  34. forState:UIControlStateNormal];
  35. [button addTarget:self action:@selector(goBack)
  36. forControlEvents:UIControlEventTouchUpInside];
  37. button.frame = CGRectMake(0, 0, 15, 18);
  38. UIBarButtonItem *menuButton = [[UIBarButtonItem alloc] initWithCustomView:button];
  39. self.navigationItem.leftBarButtonItem = menuButton;
  40. }
  41. -(void)initUI{
  42. _vTableView = [[UITableView alloc]
  43. initWithFrame:CGRectMake(0,
  44. 0,
  45. self.view.frame.size.width,
  46. self.view.frame.size.height)];
  47. _vTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  48. _vTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
  49. _vTableView.backgroundColor = [UIColor whiteColor];
  50. _vTableView.delegate = self;
  51. _vTableView.dataSource=self;
  52. [self.view addSubview:_vTableView];
  53. }
  54. #pragma mark - tableView回调
  55. /**
  56. 单元格cell个数
  57. @param tableView <#tableView description#>
  58. @param section <#section description#>
  59. @return <#return value description#>
  60. */
  61. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  62. {
  63. return [_settlementMethodArray count];
  64. }
  65. /**
  66. <#Description#>
  67. @param tableView <#tableView description#>
  68. @return <#return value description#>
  69. */
  70. -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  71. return 1;
  72. }
  73. /**
  74. 高度
  75. @param tableView <#tableView description#>
  76. @param indexPath <#indexPath description#>
  77. @return <#return value description#>
  78. */
  79. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  80. return 46;
  81. }
  82. /**
  83. 点击单元格事件
  84. @param tableView tableView description
  85. @param indexPath indexPath description
  86. */
  87. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  88. {
  89. CollecteAmountModel *collectAmountModel = [_settlementMethodArray objectAtIndex:indexPath.row];
  90. if([self.settlementDelegate respondsToSelector:@selector(callbackSettlementMethod:)])
  91. {
  92. [self.settlementDelegate callbackSettlementMethod:collectAmountModel];
  93. }
  94. [self.navigationController popViewControllerAnimated:YES];
  95. }
  96. /**
  97. 每个单元格cell
  98. @param tableView <#tableView description#>
  99. @param indexPath <#indexPath description#>
  100. @return <#return value description#>
  101. */
  102. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  103. {
  104. static NSString *cellIdentifier = @"SettlementMethodCell";
  105. SettlementMethodCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier ];
  106. cell=[[SettlementMethodCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
  107. cell.selectionStyle=UITableViewCellSelectionStyleNone;
  108. CollecteAmountModel *earnestModel = [_settlementMethodArray objectAtIndex:indexPath.row];
  109. [cell parseEarnestInfo:earnestModel];
  110. return cell;
  111. }
  112. @end