ReviseHeadCell.m 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // ReviseHeadCell.m
  3. // jitao
  4. //
  5. // Created by 罗云飞 on 2017/12/7.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import "ReviseHeadCell.h"
  9. @implementation ReviseHeadCell
  10. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  11. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  12. if (self) {
  13. _headimage = [UIImageView new];
  14. // _headimage.backgroundColor = NewRedColor;
  15. ViewRadius(_headimage, fitScreenWidth(53)/2);
  16. [self.contentView addSubview:_headimage];
  17. _headimage.sd_layout
  18. .widthIs(fitScreenWidth(53))
  19. .heightIs(fitScreenWidth(53))
  20. .topSpaceToView(self.contentView, fitScreenWidth(10))
  21. .centerXEqualToView(self.contentView);
  22. _reviseheadlabel = [UILabel new];
  23. _reviseheadlabel.font = NewFont(12);
  24. _reviseheadlabel.textColor = [UIColor colorWithString:@"#9A9A9A"];
  25. [_reviseheadlabel setSingleLineAutoResizeWithMaxWidth:0];
  26. [self.contentView addSubview:_reviseheadlabel];
  27. _reviseheadlabel.sd_layout
  28. .centerXEqualToView(self.contentView)
  29. .topSpaceToView(_headimage, fitScreenWidth(2))
  30. .heightIs(13);
  31. }
  32. return self;
  33. }
  34. - (void)assignment:(NSString *)nickname headimageurl:(NSString *)imageurl {
  35. if([nickname isEqual:[NSNull null]]) {
  36. _reviseheadlabel.text = @"";
  37. }else{
  38. _reviseheadlabel.text = nickname;
  39. }
  40. [_headimage sd_setImageWithURL:NewURL([imageurl mosaicUrlPrefix]) placeholderImage:NewImageNamed(@"用户头像默认")];
  41. }
  42. - (void)awakeFromNib {
  43. [super awakeFromNib];
  44. // Initialization code
  45. }
  46. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  47. [super setSelected:selected animated:animated];
  48. // Configure the view for the selected state
  49. }
  50. @end