GoodsDetailsCell.m 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. //
  2. // GoodsDetailsCell.m
  3. // BuguLive
  4. //
  5. // Created by fanwe2014 on 16/10/15.
  6. // Copyright © 2016年 xfg. All rights reserved.
  7. //
  8. #import "GoodsDetailsCell.h"
  9. @implementation GoodsDetailsCell
  10. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  11. {
  12. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  13. if (self)
  14. {
  15. self.buttonCount = 0;
  16. // self.BuguLive = [GlobalVariables sharedInstance];
  17. self.detailLabel = [[UILabel alloc]init];
  18. self.detailLabel.frame = CGRectMake(10, 0, kScreenW-65, 50);
  19. self.detailLabel.numberOfLines = 1;
  20. self.detailLabel.text = ASLocalizedString(@"拍品详情");
  21. self.detailLabel.lineBreakMode = NSLineBreakByTruncatingTail;
  22. self.detailLabel.textColor = kAppGrayColor1;
  23. [self addSubview:self.detailLabel];
  24. // self.lineView = [[UIView alloc]initWithFrame:CGRectMake(10, 48, kScreenW-10, 1)];
  25. // self.lineView.backgroundColor = kGrayTransparentColor1;
  26. // [self addSubview:self.lineView];
  27. self.downUpImgView = [[UIImageView alloc]initWithFrame:CGRectMake(kScreenW-27, 20, 17, 9)];
  28. self.downUpImgView.image = [UIImage imageNamed:@"com_arrow_down_2"];
  29. [self addSubview:self.downUpImgView];
  30. self.clickButton = [UIButton buttonWithType:UIButtonTypeCustom];
  31. self.clickButton.frame = CGRectMake(kScreenW-65,0,55,50);
  32. self.clickButton.backgroundColor = kClearColor;
  33. [self.clickButton addTarget:self action:@selector(changeHeight:) forControlEvents:UIControlEventTouchUpInside];
  34. [self addSubview:self.clickButton];
  35. }
  36. return self;
  37. }
  38. - (void)setCellWitCount:(int)count
  39. {
  40. self.buttonCount = count;
  41. }
  42. - (void)changeHeight:(UIButton *)button
  43. {
  44. if (self.buttonCount == 0)
  45. {
  46. self.buttonCount = 1;
  47. self.downUpImgView.image = [UIImage imageNamed:@"com_arrow_up_1"];
  48. //[self.clickButton setTitle:ASLocalizedString(@"[收起]")forState:UIControlStateNormal];
  49. }else
  50. {
  51. self.buttonCount = 0;
  52. self.downUpImgView.image = [UIImage imageNamed:@"com_arrow_down_2"];
  53. //[self.clickButton setTitle:ASLocalizedString(@"[展开]")forState:UIControlStateNormal];
  54. }
  55. if (self.delegate)
  56. {
  57. if ([self.delegate respondsToSelector:@selector(getCellHeightWithCount:)])
  58. {
  59. [self.delegate getCellHeightWithCount:self.buttonCount];
  60. }
  61. }
  62. }
  63. @end