dkahgld

ZBUserInfoListCell.m 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //
  2. // ZBUserInfoListCell.m
  3. // ZBProject
  4. //
  5. // Created by 学丽 on 2019/5/6.
  6. // Copyright © 2019 ZB. All rights reserved.
  7. //
  8. #import "ZBUserInfoListCell.h"
  9. @implementation ZBUserInfoListCell
  10. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  11. {
  12. self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
  13. if (self) {
  14. [self addSubview:self.titleLabel];
  15. [self addSubview:self.rightLabel];
  16. [self addSubview:self.headImg];
  17. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  18. make.left.mas_equalTo(10);
  19. make.width.mas_equalTo(70); make.height.mas_equalTo(self.mas_height);
  20. }];
  21. [self.headImg mas_makeConstraints:^(MASConstraintMaker *make) {
  22. make.left.mas_equalTo(self.titleLabel.mas_right).offset(25);
  23. make.top.mas_equalTo(5);
  24. make.width.height.mas_equalTo(self.mas_height).offset(-10);
  25. make.bottom.mas_equalTo(-5);
  26. }];
  27. [self.rightLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  28. make.left.mas_equalTo(self.titleLabel.mas_right).offset(25);
  29. make.height.mas_equalTo(self.mas_height);
  30. }];
  31. UIImageView *linev =[[UIImageView alloc]init];
  32. linev.backgroundColor=[UIColor backgroudColor];
  33. [self addSubview:linev];
  34. [linev mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.left.mas_equalTo(10);
  36. make.right.mas_equalTo(-10);
  37. make.bottom.mas_equalTo(-1);
  38. make.height.mas_equalTo(1);
  39. }];
  40. }
  41. return self;
  42. }
  43. -(void)setDics:(NSDictionary *)dics
  44. {
  45. _dics = dics;
  46. if ([dics[@"name"]isEqualToString:@"我的头像"]) {
  47. self.rightLabel.hidden=YES;
  48. self.headImg.hidden=NO;
  49. }else{
  50. self.rightLabel.hidden=NO;
  51. self.headImg.hidden=YES;
  52. }
  53. self.titleLabel.text=dics[@"name"];
  54. self.rightLabel.text=dics[@"content"];
  55. }
  56. -(UIImageView *)headImg
  57. {
  58. if (!_headImg) {
  59. _headImg=[[UIImageView alloc]init];
  60. _headImg.layer.cornerRadius=23.5;
  61. _headImg.layer.masksToBounds=YES;
  62. }
  63. return _headImg;
  64. }
  65. -(UILabel *)titleLabel
  66. {
  67. if (!_titleLabel) {
  68. _titleLabel =[[UILabel alloc]init];
  69. _titleLabel.text=@"我的手机号";
  70. _titleLabel.textColor=[UIColor YHColorWithHex:0x3E3E3E];
  71. _titleLabel.font=[UIFont systemFontOfSize:16];
  72. }
  73. return _titleLabel;
  74. }
  75. -(UILabel *)rightLabel
  76. {
  77. if (!_rightLabel) {
  78. _rightLabel =[[UILabel alloc]init];
  79. _rightLabel.text=[AccountTool account].phone;
  80. _rightLabel.textColor=[UIColor YHColorWithHex:0x999999];
  81. _rightLabel.font=[UIFont systemFontOfSize:14];
  82. }
  83. return _rightLabel;
  84. }
  85. @end