LogCommentTableViewCell.m 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. //
  2. // LogCommentTableViewCell.m
  3. // IBOSS
  4. //
  5. // Created by Dongke on 15/11/2.
  6. // Copyright © 2015年 elongtian. All rights reserved.
  7. //
  8. #import "LogCommentTableViewCell.h"
  9. #import "LogShareAndCommentInfoModel.h"
  10. @implementation LogCommentTableViewCell
  11. -(void)parseInfoModel:(LogShareAndCommentInfoModel*)model{
  12. CGFloat xpadding =10;
  13. CGFloat ypadding =8;
  14. NSDictionary *logDict = @{NSFontAttributeName:kTextFont};
  15. NSString *titleUserCode=@"用户编码:";
  16. CGRect titleUserCodeFrame = [titleUserCode textRectWithSize:CGSizeMake(100, MAXFLOAT) attributes:logDict];
  17. titleUserCodeFrame.origin.x =20;
  18. titleUserCodeFrame.origin.y = ypadding;
  19. UILabel *lblTitleUserCode=[[UILabel alloc]init];
  20. lblTitleUserCode.backgroundColor = [UIColor clearColor];
  21. lblTitleUserCode.frame=titleUserCodeFrame;
  22. lblTitleUserCode.text=titleUserCode;
  23. lblTitleUserCode.textColor = [UIColor lightGrayColor];
  24. lblTitleUserCode.font =kTextFont;
  25. [self.contentView addSubview:lblTitleUserCode];
  26. NSString *userCode= [model userCode];
  27. CGRect userCodeFrame = [userCode textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:logDict];
  28. userCodeFrame.origin.x =CGRectGetMaxX(titleUserCodeFrame)+xpadding;
  29. userCodeFrame.origin.y = ypadding;
  30. _lblUserCode=[[UILabel alloc]init];
  31. _lblUserCode.backgroundColor = [UIColor clearColor];
  32. _lblUserCode.frame=userCodeFrame;
  33. _lblUserCode.text=userCode;
  34. _lblUserCode.numberOfLines=0;
  35. _lblUserCode.textColor = [UIColor lightGrayColor];
  36. _lblUserCode.font =kTextFont;
  37. [self.contentView addSubview:_lblUserCode];
  38. NSString *titleUserName=@"用户姓名:";
  39. CGRect titleUserNameFrame = [titleUserName textRectWithSize:CGSizeMake(100, MAXFLOAT) attributes:logDict];
  40. titleUserNameFrame.origin.x =20;
  41. titleUserNameFrame.origin.y = CGRectGetMaxY(titleUserCodeFrame)+ypadding;
  42. UILabel *lblTitleUserName=[[UILabel alloc]init];
  43. lblTitleUserName.backgroundColor = [UIColor clearColor];
  44. lblTitleUserName.frame=titleUserNameFrame;
  45. lblTitleUserName.text=titleUserName;
  46. lblTitleUserName.textColor = [UIColor lightGrayColor];
  47. lblTitleUserName.font =kTextFont;
  48. [self.contentView addSubview:lblTitleUserName];
  49. //用户名frame
  50. NSString *userName= [model userName];
  51. CGRect userNameFrame = [userName textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:logDict];
  52. userNameFrame.origin.x =CGRectGetMaxX(titleUserNameFrame)+xpadding;
  53. userNameFrame.origin.y = CGRectGetMaxY(titleUserCodeFrame)+ypadding;
  54. _lblUserName=[[UILabel alloc]init];
  55. _lblUserName.backgroundColor = [UIColor clearColor];
  56. _lblUserName.frame=userNameFrame;
  57. _lblUserName.numberOfLines=0;
  58. _lblUserName.text=userName;
  59. _lblUserName.textColor = [UIColor lightGrayColor];
  60. _lblUserName.font =kTextFont;
  61. [self.contentView addSubview:_lblUserName];
  62. NSString *titleOrganization=@"所属部门:";
  63. CGRect titleOrganizationFrame = [titleOrganization textRectWithSize:CGSizeMake(100, MAXFLOAT) attributes:logDict];
  64. titleOrganizationFrame.origin.x =20;
  65. titleOrganizationFrame.origin.y = CGRectGetMaxY(titleUserNameFrame)+ypadding;
  66. UILabel *lblTitleOrganization=[[UILabel alloc]init];
  67. lblTitleOrganization.backgroundColor = [UIColor clearColor];
  68. lblTitleOrganization.frame=titleOrganizationFrame;
  69. lblTitleOrganization.text=titleOrganization;
  70. lblTitleOrganization.textColor = [UIColor lightGrayColor];
  71. lblTitleOrganization.font =kTextFont;
  72. [self.contentView addSubview:lblTitleOrganization];
  73. NSString *organization= [model orgName];
  74. CGRect organizationFrame = [organization textRectWithSize:CGSizeMake(200, MAXFLOAT) attributes:logDict];
  75. organizationFrame.origin.x =CGRectGetMaxX(titleOrganizationFrame)+xpadding;
  76. organizationFrame.origin.y = CGRectGetMaxY(titleUserNameFrame)+ypadding;
  77. _lblOrg=[[UILabel alloc]init];
  78. _lblOrg.backgroundColor = [UIColor clearColor];
  79. _lblOrg.frame=organizationFrame;
  80. _lblOrg.text=organization;
  81. _lblOrg.numberOfLines=0;
  82. _lblOrg.textColor = [UIColor lightGrayColor];
  83. _lblOrg.font =kTextFont;
  84. [self.contentView addSubview:_lblOrg];
  85. _separatorView=[UIView new];
  86. _separatorView.frame=CGRectMake(0, CGRectGetMaxY(titleOrganizationFrame)+ypadding, Screen_Width,1);
  87. _separatorView.backgroundColor=LineBackgroundColor;
  88. [self.contentView addSubview:_separatorView];
  89. _userId=model.userId;
  90. }
  91. - (CGFloat)height{
  92. CGFloat height= CGRectGetMaxY(_separatorView.frame);
  93. return height;
  94. }
  95. -(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  96. self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
  97. if(self){
  98. }
  99. return self;
  100. }
  101. -(void)btnGoCheck{
  102. if ([self.delegate respondsToSelector:@selector(btnCheckPressed:)]) {
  103. [self.delegate btnCheckPressed:self];
  104. }
  105. }
  106. @end