JXReadListCell.m 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. //
  2. // JXReadListCell.m
  3. // shiku_im
  4. //
  5. // Created by p on 2017/9/2.
  6. // Copyright © 2017年 Reese. All rights reserved.
  7. //
  8. #import "JXReadListCell.h"
  9. @interface JXReadListCell ()
  10. @property (nonatomic, strong) JXImageView *headImageView;
  11. @property (nonatomic, strong) UILabel *nameLable;
  12. @property (nonatomic, strong) UILabel *subLabel;
  13. @property (nonatomic, strong) UILabel *timeLabel;
  14. @end
  15. @implementation JXReadListCell
  16. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  17. {
  18. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  19. if(self){
  20. _headImageView = [[JXImageView alloc]init];
  21. _headImageView.userInteractionEnabled = NO;
  22. _headImageView.frame = CGRectMake(13,5,50,50);
  23. _headImageView.layer.cornerRadius = 25;
  24. _headImageView.layer.masksToBounds = YES;
  25. // _headImageView.layer.borderWidth = 0.5;
  26. _headImageView.layer.borderColor = [UIColor darkGrayColor].CGColor;
  27. [self.contentView addSubview:self.headImageView];
  28. _nameLable = [[UILabel alloc] initWithFrame:CGRectMake(80, 9, JX_SCREEN_WIDTH -60 - 80, 20)];
  29. _nameLable.textColor = [UIColor blackColor];
  30. _nameLable.userInteractionEnabled = NO;
  31. _nameLable.backgroundColor = [UIColor clearColor];
  32. _nameLable.font = g_factory.font15;
  33. _nameLable.tag = self.index;
  34. [self.contentView addSubview:_nameLable];
  35. _subLabel = [[UILabel alloc]initWithFrame:CGRectMake(80, 23, JX_SCREEN_WIDTH-60, 35)];
  36. _subLabel.textColor = [UIColor lightGrayColor];
  37. _subLabel.userInteractionEnabled = NO;
  38. _subLabel.backgroundColor = [UIColor clearColor];
  39. _subLabel.font = [UIFont systemFontOfSize:12];
  40. [self.contentView addSubview:_subLabel];
  41. _timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(JX_SCREEN_WIDTH - 220, 9, 200, 20)];
  42. _timeLabel.textColor = [UIColor lightGrayColor];
  43. _timeLabel.userInteractionEnabled = NO;
  44. _timeLabel.backgroundColor = [UIColor clearColor];
  45. _timeLabel.textAlignment = NSTextAlignmentRight;
  46. _timeLabel.font = [UIFont systemFontOfSize:11];
  47. [self.contentView addSubview:_timeLabel];
  48. UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, 60 - LINE_WH, JX_SCREEN_WIDTH, LINE_WH)];
  49. line.backgroundColor = THE_LINE_COLOR;
  50. [self.contentView addSubview:line];
  51. }
  52. return self;
  53. }
  54. - (void) setData:(JXUserObject *)obj {
  55. _headImageView.tag = self.index;
  56. _headImageView.delegate = self.delegate;
  57. _headImageView.didTouch = self.didTouch;
  58. [g_server getHeadImageLarge:obj.userId userName:obj.userNickname imageView:_headImageView];
  59. NSString *name = [NSString string];
  60. for (memberData *member in _room.members) {
  61. if ([obj.userId intValue] == (int)member.userId) {
  62. name = member.lordRemarkName.length > 0 ? member.lordRemarkName : member.userNickName;
  63. }
  64. }
  65. _nameLable.text = obj.userNickname.length > 0 ? obj.userNickname : name;
  66. _subLabel.text = obj.userId;
  67. _timeLabel.text = [NSString stringWithFormat:@"%@:%@",Localized(@"JX_ReadingTime"),[TimeUtil formatDate:obj.timeSend format:@"MM-dd HH:mm"]];
  68. }
  69. - (void)awakeFromNib {
  70. [super awakeFromNib];
  71. // Initialization code
  72. }
  73. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  74. [super setSelected:selected animated:animated];
  75. // Configure the view for the selected state
  76. }
  77. @end