PaymentMethodCell.m 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. //
  2. // DepositAmountCell.m
  3. // IBOSS
  4. //
  5. // Created by 关宏厚 on 2020/7/24.
  6. // Copyright © 2020 elongtian. All rights reserved.
  7. //
  8. #import "PaymentMethodCell.h"
  9. @interface PaymentMethodCell()<UITextFieldDelegate>{
  10. }
  11. @end
  12. @implementation PaymentMethodCell
  13. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  14. {
  15. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  16. if (self) {
  17. }
  18. return self;
  19. }
  20. - (void)parsePaymentMethod:(PayTypeModel *) model
  21. {
  22. UILabel *lbPaymentNameTitle = [[UILabel alloc] init];
  23. lbPaymentNameTitle.frame = CGRectMake(10, 10,0, 0);
  24. lbPaymentNameTitle.text = @"收款名称:";
  25. lbPaymentNameTitle.font =[UIFont systemFontOfSize:14];
  26. [lbPaymentNameTitle sizeToFit];
  27. [self.contentView addSubview:lbPaymentNameTitle];
  28. UILabel *lbPaymentName = [[UILabel alloc] init];
  29. lbPaymentName.frame = CGRectMake(CGRectGetMaxX(lbPaymentNameTitle.frame)+5, 10,0, 0);
  30. lbPaymentName.text = model.settlementTypeName;
  31. lbPaymentName.font =[UIFont systemFontOfSize:14];
  32. [lbPaymentName sizeToFit];
  33. [self.contentView addSubview:lbPaymentName];
  34. UILabel *lblAmountInfo = [[UILabel alloc] init];
  35. lblAmountInfo.frame = CGRectMake(10,CGRectGetMaxY(lbPaymentNameTitle.frame)+15,0, 0);
  36. lblAmountInfo.text = @"收款金额:";
  37. lblAmountInfo.font =[UIFont systemFontOfSize:14];
  38. [lblAmountInfo sizeToFit];
  39. [self.contentView addSubview:lblAmountInfo];
  40. UITextField *txtAmountInfo = [[UITextField alloc] init];
  41. txtAmountInfo.frame = CGRectMake(CGRectGetMaxX(lblAmountInfo.frame)+5, CGRectGetMaxY(lbPaymentNameTitle.frame)+15,SCREENWIDTH-(CGRectGetMaxX(lblAmountInfo.frame)+5),18);
  42. txtAmountInfo.font =[UIFont systemFontOfSize:14];
  43. txtAmountInfo.tag = 1001;
  44. txtAmountInfo.keyboardType=UIKeyboardTypeDecimalPad;
  45. txtAmountInfo.delegate = self;
  46. txtAmountInfo.text=model.receivableSum;
  47. txtAmountInfo.placeholder = @"请输入金额";
  48. [self.contentView addSubview:txtAmountInfo];
  49. UILabel *lbRemark = [[UILabel alloc] init];
  50. lbRemark.frame = CGRectMake(10,CGRectGetMaxY(lblAmountInfo.frame)+15,0, 0);
  51. lbRemark.text = @"备 注:";
  52. lbRemark.font =[UIFont systemFontOfSize:14];
  53. [lbRemark sizeToFit];
  54. [self.contentView addSubview:lbRemark];
  55. UITextField *tfRemark = [[UITextField alloc] init];
  56. tfRemark.frame = CGRectMake(CGRectGetMaxX(lbRemark.frame)+5, CGRectGetMaxY(lblAmountInfo.frame)+15,SCREENWIDTH-(CGRectGetMaxX(lbRemark.frame)+5),18);
  57. tfRemark.tag = 1002;
  58. tfRemark.font =[UIFont systemFontOfSize:14];
  59. tfRemark.delegate = self;
  60. tfRemark.text=model.remarks;
  61. tfRemark.placeholder = @"请输入备注";
  62. [self.contentView addSubview:tfRemark];
  63. UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(lbRemark.frame)+5, SCREENWIDTH, 1)];
  64. line.backgroundColor = LineBackgroundColor;
  65. [self.contentView addSubview:line];
  66. }
  67. /**
  68. textfield结束编辑回调函数
  69. @param field <#field description#>
  70. */
  71. - (void) textFieldDidEndEditing:(UITextField *) field
  72. {
  73. [self endEditing:YES];
  74. if(field.tag == 1001){
  75. [_cellDelegate update:(int)_position flag:1 text:field.text];
  76. }
  77. else{
  78. [_cellDelegate update:(int)_position flag:2 text:field.text];
  79. }
  80. }
  81. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  82. [super setSelected:selected animated:animated];
  83. }
  84. @end