TwoSectionTableViewCell.m 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. //
  2. // TwoSectionTableViewCell.m
  3. // BuguLive
  4. //
  5. // Created by fanwe2014 on 16/8/5.
  6. // Copyright © 2016年 xfg. All rights reserved.
  7. //
  8. #import "TwoSectionTableViewCell.h"
  9. #import "AcutionDetailModel.h"
  10. #import "InfoModel.h"
  11. @interface TwoSectionTableViewCell ()
  12. {
  13. AcutionDetailModel *ADModel;
  14. InfoModel *IModel;
  15. }
  16. @end
  17. @implementation TwoSectionTableViewCell
  18. - (void)awakeFromNib
  19. {
  20. [super awakeFromNib];
  21. self.lineView.backgroundColor = self.lineView2.backgroundColor = self.lineView3.backgroundColor =kAppSpaceColor4;
  22. self.view1 = [[UIView alloc]init];
  23. self.view2 = [[UIView alloc]init];
  24. self.view3 = [[UIView alloc]init];
  25. self.view1.backgroundColor = kClearColor;
  26. self.view2.backgroundColor = kClearColor;
  27. self.view3.backgroundColor = kClearColor;
  28. self.imgView1 = [[UIImageView alloc]init];
  29. self.imgView2 = [[UIImageView alloc]init];
  30. self.imgView3 = [[UIImageView alloc]init];
  31. self.imgView1.image = [UIImage imageNamed:@"ac_gold_diamond"];
  32. self.imgView2.image = [UIImage imageNamed:@"ac_gold_diamond"];
  33. self.imgView3.image = [UIImage imageNamed:@"ac_gold_diamond"];
  34. self.startPriceLabel.textColor = kAppGrayColor1;
  35. self.addPriceLabel.textColor = kAppGrayColor1;
  36. self.depositLabel.textColor = kAppGrayColor1;
  37. self.priceLabel1 = [[UILabel alloc]init];
  38. self.priceLabel2 = [[UILabel alloc]init];
  39. self.priceLabel13 = [[UILabel alloc]init];
  40. self.priceLabel13.textColor = kAppGrayColor1;
  41. self.priceLabel1.textColor = kAppGrayColor1;
  42. self.priceLabel2.textColor = kAppGrayColor1;
  43. self.mostTimeLabel.textColor = kAppGrayColor1;
  44. self.cycleLabel.textColor = kAppGrayColor1;
  45. [self addSubview:self.view1];
  46. [self addSubview:self.view2];
  47. [self addSubview:self.view3];
  48. self.backgroundColor = kAppPurpleColor;
  49. }
  50. - (void)creatCellWithArray:(NSMutableArray *)array
  51. {
  52. if (array.count)
  53. {
  54. ADModel = array[0];
  55. }else
  56. {
  57. ADModel = [AcutionDetailModel new];
  58. }
  59. if (!ADModel.info)
  60. {
  61. IModel = [[InfoModel alloc]init];
  62. }else
  63. {
  64. IModel = ADModel.info;
  65. }
  66. //起拍价
  67. NSString *string;
  68. if (ADModel.info.qp_diamonds.length > 0)
  69. {
  70. string = ADModel.info.qp_diamonds;
  71. }else
  72. {
  73. string = @"0";
  74. }
  75. NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:string];
  76. [attr setAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14.0]} range:NSMakeRange(0, string.length)];
  77. CGFloat width =[string sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14]}].width;
  78. self.imgView1.frame = CGRectMake(0, 4.5, 13, 10);
  79. self.priceLabel1.frame = CGRectMake(self.imgView1.frame.size.width+self.imgView1.frame.origin.x+3,0,width, 19);
  80. self.priceLabel1.attributedText = attr;
  81. self.view1.frame = CGRectMake((kScreenW-2)/6-(width+16)/2, 40, width+13+3, 19);
  82. [self.view1 addSubview:self.imgView1];
  83. [self.view1 addSubview:self.priceLabel1];
  84. //加价幅度
  85. NSString *string1;
  86. if (ADModel.info.jj_diamonds.length > 0)
  87. {
  88. string1 = ADModel.info.jj_diamonds;
  89. }else
  90. {
  91. string1 = @"0";
  92. }
  93. NSMutableAttributedString *attr1 = [[NSMutableAttributedString alloc] initWithString:string1];
  94. [attr1 setAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14.0]} range:NSMakeRange(0, string1.length)];
  95. CGFloat width1 =[string1 sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0]}].width;
  96. self.imgView2.frame = CGRectMake(0, 4.5, 13, 10);
  97. self.priceLabel2.frame = CGRectMake(self.imgView2.frame.size.width+self.imgView2.frame.origin.x+3,0,width1, 19);
  98. self.priceLabel2.attributedText = attr1;
  99. self.view2.frame = CGRectMake(kScreenW/2-(width1+16)/2, 40, width1+13+3, 19);
  100. [self.view2 addSubview:self.imgView2];
  101. [self.view2 addSubview:self.priceLabel2];
  102. //保证金
  103. NSString *string2;
  104. if (ADModel.info.bz_diamonds.length > 0)
  105. {
  106. string2 = ADModel.info.bz_diamonds;
  107. }else
  108. {
  109. string2 = @"0";
  110. }
  111. NSMutableAttributedString *attr2 = [[NSMutableAttributedString alloc] initWithString:string2];
  112. [attr2 setAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:14.0]} range:NSMakeRange(0, string2.length)];
  113. CGFloat width2 =[string2 sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0]}].width;
  114. self.imgView3.frame = CGRectMake(0, 4.5, 13, 10);
  115. self.priceLabel13.frame = CGRectMake(self.imgView3.frame.size.width+self.imgView3.frame.origin.x+3,0,width2, 19);
  116. self.priceLabel13.attributedText = attr2;
  117. self.view3.frame = CGRectMake((kScreenW-2)*5/6+2-(width2+16)/2, 40, width2+13+3, 19);
  118. [self.view3 addSubview:self.imgView3];
  119. [self.view3 addSubview:self.priceLabel13];
  120. if (IModel.pai_yanshi.length < 1)
  121. {
  122. IModel.pai_yanshi = @"0";
  123. }
  124. if (IModel.max_yanshi.length < 1)
  125. {
  126. IModel.max_yanshi = @"0";
  127. }
  128. self.cycleLabel.text = [NSString stringWithFormat:ASLocalizedString(@"延时周期: %@分钟/次"),IModel.pai_yanshi];
  129. self.mostTimeLabel.text = [NSString stringWithFormat:ASLocalizedString(@"最大延时次数: %@次"),IModel.max_yanshi];
  130. }
  131. @end