JOSWXXCell.m 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. //
  2. // JOSWXXCell.m
  3. // shiku_im
  4. //
  5. // Created by 周兵 on 16/6/29.
  6. // Copyright © 2016年 Reese. All rights reserved.
  7. //
  8. #import "JOSWXXCell.h"
  9. #import "JOSWXXModel.h"
  10. @interface JOSWXXCell()
  11. @property (nonatomic,strong) UILabel * contentLabel;
  12. @property (nonatomic,strong) UILabel * dateTimeLabel;
  13. @end
  14. @implementation JOSWXXCell
  15. + (instancetype)cellWithTableView:(UITableView *)tableView
  16. {
  17. static NSString *ID = @"status";
  18. JOSWXXCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
  19. if (!cell) {
  20. cell = [[JOSWXXCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
  21. }
  22. return cell;
  23. }
  24. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  25. {
  26. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  27. if(self)
  28. {
  29. //cell点击美效果
  30. self.selectionStyle=UITableViewCellSelectionStyleNone;
  31. self.contentView.backgroundColor=JOColor(160,160,160,0.1);
  32. //初始化控件内容
  33. [self setDYModel];
  34. }
  35. return self;
  36. }
  37. /**
  38. * 我的商务消息,初始化
  39. */
  40. - (void)setDYModel
  41. {
  42. UIView * bottomView=[[UIView alloc]init];
  43. bottomView.backgroundColor=[UIColor whiteColor];
  44. bottomView.frame=CGRectMake(20,10,self.frame.size.width-40,80);
  45. [self.contentView addSubview:bottomView];
  46. /**1,图片*/
  47. UIImageView * imageV=[[UIImageView alloc]init];
  48. imageV.frame=CGRectMake(10,10,16,16);
  49. imageV.image=[UIImage imageNamed:@"uu_swxx_02"];
  50. [bottomView addSubview:imageV];
  51. /**2,标题*/
  52. UILabel * title=[[UILabel alloc]init];
  53. title.frame=CGRectMake(25,0,80,30);
  54. title.text=@"商务消息";
  55. title.font=[UIFont systemFontOfSize:14];
  56. title.backgroundColor=[UIColor clearColor];
  57. title.textColor=[UIColor orangeColor];
  58. title.textAlignment=1;
  59. [bottomView addSubview:title];
  60. /**3,内容*/
  61. UILabel * content=[[UILabel alloc]init];
  62. content.frame=CGRectMake(10,35,30,25);
  63. content.text=@"内容:";
  64. content.textAlignment=0;
  65. content.textColor=JOColor(160,160,160,0.5);
  66. content.backgroundColor=[UIColor clearColor];
  67. content.font=[UIFont systemFontOfSize:12];
  68. [bottomView addSubview:content];
  69. /**4,日期时间*/
  70. UILabel * dateTime=[[UILabel alloc]init];
  71. dateTime.frame=CGRectMake(10,55,30,25);
  72. dateTime.text=@"时间:";
  73. dateTime.textAlignment=0;
  74. dateTime.textColor=JOColor(160,160,160,0.5);
  75. dateTime.backgroundColor=[UIColor clearColor];
  76. dateTime.font=[UIFont systemFontOfSize:12];
  77. [bottomView addSubview:dateTime];
  78. /**5,内容描述*/
  79. UILabel * contentStr=[[UILabel alloc]init];
  80. contentStr.frame=CGRectMake(45,35,self.frame.size.width-90,25);
  81. contentStr.text=@"这个是商务消息,消息很长需要换行怎么办呢啦啦啦啦啦啦啦啦lalalalalalla";
  82. contentStr.textAlignment=0;
  83. contentStr.numberOfLines=0;
  84. contentStr.textColor=[UIColor blackColor];
  85. contentStr.backgroundColor=[UIColor clearColor];
  86. contentStr.font=[UIFont systemFontOfSize:13];
  87. [bottomView addSubview:contentStr];
  88. self.contentLabel=contentStr;
  89. /**6,内容描述*/
  90. UILabel * dateStr=[[UILabel alloc]init];
  91. dateStr.frame=CGRectMake(45,55,self.frame.size.width-90,25);
  92. dateStr.text=@"2016-06-27 17:56:45";
  93. dateStr.textAlignment=0;
  94. dateStr.numberOfLines=0;
  95. dateStr.textColor=[UIColor blackColor];
  96. dateStr.backgroundColor=[UIColor clearColor];
  97. dateStr.font=[UIFont systemFontOfSize:13];
  98. [bottomView addSubview:dateStr];
  99. self.dateTimeLabel=dateStr;
  100. }
  101. - (void)setSWXXModel:(JOSWXXModel *)SWXXModel
  102. {
  103. _SWXXModel=SWXXModel;
  104. self.dateTimeLabel.text=_SWXXModel.time;
  105. self.contentLabel.text=_SWXXModel.content;
  106. }
  107. - (void)awakeFromNib {
  108. // Initialization code
  109. }
  110. - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
  111. [super setSelected:selected animated:animated];
  112. // Configure the view for the selected state
  113. }
  114. @end