Няма описание

FKMyCircleEditCell.m 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. //
  2. // FKMyCircleEditCell.m
  3. // FirstLink
  4. //
  5. // Created by jack on 16/6/13.
  6. // Copyright © 2016年 FirstLink. All rights reserved.
  7. //
  8. #import "FKMyCircleEditCell.h"
  9. #import "FKMyCircleViewModel.h"
  10. @interface FKMyCircleEditCell ()
  11. @property (nonatomic, strong) UIView *containerView;
  12. @property (nonatomic, strong) UIView *coverLine;
  13. @end
  14. @implementation FKMyCircleEditCell
  15. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  16. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  17. [self addAllSubviews];
  18. self.selectionStyle = UITableViewCellSelectionStyleNone;
  19. self.backgroundColor = [UIColor clearColor];
  20. }
  21. return self;
  22. }
  23. - (void)addAllSubviews{
  24. [self.contentView addSubview:self.containerView];
  25. [self.contentView addSubview:self.coverLine];
  26. [self.containerView addSubview:self.timeLabel];
  27. [self.containerView addSubview:self.editBtn];
  28. [self.containerView addSubview:self.coverLine];
  29. [self.containerView mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.edges.insets(UIEdgeInsetsMake(0, 5, 0, 5));
  31. }];
  32. [self.coverLine mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.top.left.right.equalTo(self.containerView);
  34. make.height.mas_equalTo(6);
  35. }];
  36. [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  37. make.left.equalTo(self.containerView).offset(12);
  38. make.centerY.equalTo(self.containerView);
  39. }];
  40. [self.editBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  41. make.right.equalTo(self.containerView);
  42. make.height.equalTo(self.containerView);
  43. make.width.mas_equalTo(55);
  44. }];
  45. }
  46. - (void)fk_configWithViewModel:(id)viewModel indexPath:(NSIndexPath *)indexPath{
  47. if ([viewModel isKindOfClass:[FKMyCircleViewModel class]]) {
  48. FKMyCircleViewModel *myCircleModel = (FKMyCircleViewModel *)viewModel;
  49. FKMyCircleContentItem *contentItem = [myCircleModel circleContentItemAtIndex:indexPath.section - 1];
  50. self.timeLabel.text = [FLStringHelper convertToCommonFormateFromString:contentItem.shareItem.createTime baseTime:myCircleModel.serveTime];
  51. }
  52. }
  53. #pragma mark - property
  54. - (UILabel *)timeLabel{
  55. if (_timeLabel == nil) {
  56. _timeLabel = [[UILabel alloc]init];
  57. _timeLabel.textColor = UIColorFromRGB(0x9b9b9b);
  58. _timeLabel.font = [UIFont systemFontOfSize:13];
  59. }
  60. return _timeLabel;
  61. }
  62. - (UIButton *)editBtn{
  63. if (_editBtn == nil) {
  64. _editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  65. [_editBtn setImage:[UIImage imageNamed:@"myCircle_edit_btn"] forState:UIControlStateNormal];
  66. }
  67. return _editBtn;
  68. }
  69. - (UIView *)containerView{
  70. if (_containerView == nil) {
  71. _containerView = [[UIView alloc]init];
  72. _containerView.backgroundColor = [UIColor whiteColor];
  73. _containerView.layer.cornerRadius = 5;
  74. }
  75. return _containerView;
  76. }
  77. - (UIView *)coverLine{
  78. if (_coverLine == nil) {
  79. _coverLine = [[UIView alloc]init];
  80. _coverLine.backgroundColor = [UIColor whiteColor];
  81. }
  82. return _coverLine;
  83. }
  84. @end