AuctionHeaderView.m 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // AuctionHeaderView.m
  3. // BuguLive
  4. //
  5. // Created by 王珂 on 16/10/13.
  6. // Copyright © 2016年 xfg. All rights reserved.
  7. //
  8. #import "AuctionHeaderView.h"
  9. #import "AuctionGoodsModel.h"
  10. @interface AuctionHeaderView()
  11. @property (nonatomic, strong) UIImageView *goodsImage;//实物竞拍图片
  12. @property (nonatomic, strong) UILabel *nameLabel;//竞拍商品名称
  13. @property (nonatomic, strong) UIImageView *diamondsImgView;//竞拍商品钻石
  14. @property (nonatomic, strong) UILabel *priceLabel;
  15. @end
  16. @implementation AuctionHeaderView
  17. - (instancetype)initWithFrame:(CGRect)frame
  18. {
  19. if (self = [super initWithFrame:frame]) {
  20. _goodsImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 100, 100)];
  21. [self addSubview:_goodsImage];
  22. _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_goodsImage.frame)+5, 10, kScreenW-CGRectGetMaxX(_goodsImage.frame)-15, 70)];
  23. _nameLabel.numberOfLines=0;
  24. _nameLabel.textColor = kAppGrayColor1;
  25. _nameLabel.font = [UIFont systemFontOfSize:15];
  26. [self addSubview:_nameLabel];
  27. _diamondsImgView = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetMaxX(_goodsImage.frame)+5,80, 20, 20)];
  28. _diamondsImgView.contentMode = UIViewContentModeScaleAspectFit;
  29. [_diamondsImgView setImage:[UIImage imageNamed:@"com_diamond_1"]];
  30. [self addSubview:_diamondsImgView];
  31. _priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_diamondsImgView.frame)+5, 80, kScreenW-CGRectGetMaxX(_diamondsImgView.frame)-15, 20)];
  32. _priceLabel.textColor = kAppGrayColor1;
  33. _priceLabel.font= [UIFont systemFontOfSize:18];
  34. [self addSubview:_priceLabel];
  35. }
  36. return self;
  37. }
  38. - (void)setModel:(AuctionGoodsModel *)model
  39. {
  40. _model=model;
  41. [_goodsImage sd_setImageWithURL:[NSURL URLWithString:model.imgs[0]]];
  42. _nameLabel.text = model.name;
  43. _priceLabel.text = model.qp_diamonds;
  44. }
  45. @end