UserInfoCell.m 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //
  2. // UserInfoCell.m
  3. // FunSDKDemo
  4. //
  5. // Created by wujiangbo on 2018/11/1.
  6. // Copyright © 2018年 wujiangbo. All rights reserved.
  7. //
  8. #import "UserInfoCell.h"
  9. #import <Masonry/Masonry.h>
  10. @implementation UserInfoCell
  11. -(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
  12. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  13. if (self) {
  14. [self makeUI];
  15. }
  16. return self;
  17. }
  18. #pragma mark -设置坐标
  19. -(void)makeUI {
  20. [self addSubview:self.mainTitle];
  21. [self addSubview:self.descriptionTitle];
  22. [self.mainTitle mas_makeConstraints:^(MASConstraintMaker *make) {
  23. make.left.equalTo(self).offset(10);
  24. make.width.equalTo(@100);
  25. make.height.equalTo(@30);
  26. make.centerY.equalTo(self);
  27. }];
  28. [self.descriptionTitle mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.right.equalTo(self).offset(-20);
  30. make.left.equalTo(self.mainTitle.mas_right).offset(10);
  31. make.centerY.equalTo(self);
  32. }];
  33. }
  34. #pragma mark - lazyload
  35. -(UILabel *)mainTitle {
  36. if (!_mainTitle) {
  37. _mainTitle = [[UILabel alloc] init];
  38. _mainTitle.textColor = [UIColor blackColor];
  39. _mainTitle.font = [UIFont systemFontOfSize:15 weight:UIFontWeightLight];
  40. }
  41. return _mainTitle;
  42. }
  43. -(UILabel *)descriptionTitle {
  44. if (!_descriptionTitle) {
  45. _descriptionTitle = [[UILabel alloc] init];
  46. _descriptionTitle.textColor = [UIColor blackColor];
  47. _descriptionTitle.textAlignment = NSTextAlignmentRight;
  48. _descriptionTitle.font = [UIFont systemFontOfSize:15 weight:UIFontWeightLight];
  49. }
  50. return _descriptionTitle;
  51. }
  52. @end