123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- //
- // FKMyCircleEditCell.m
- // FirstLink
- //
- // Created by jack on 16/6/13.
- // Copyright © 2016年 FirstLink. All rights reserved.
- //
- #import "FKMyCircleEditCell.h"
- #import "FKMyCircleViewModel.h"
- @interface FKMyCircleEditCell ()
- @property (nonatomic, strong) UIView *containerView;
- @property (nonatomic, strong) UIView *coverLine;
- @end
- @implementation FKMyCircleEditCell
- - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
-
- [self addAllSubviews];
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- self.backgroundColor = [UIColor clearColor];
- }
- return self;
- }
- - (void)addAllSubviews{
-
- [self.contentView addSubview:self.containerView];
- [self.contentView addSubview:self.coverLine];
- [self.containerView addSubview:self.timeLabel];
- [self.containerView addSubview:self.editBtn];
- [self.containerView addSubview:self.coverLine];
-
- [self.containerView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.edges.insets(UIEdgeInsetsMake(0, 5, 0, 5));
- }];
-
- [self.coverLine mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.left.right.equalTo(self.containerView);
- make.height.mas_equalTo(6);
- }];
-
- [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.containerView).offset(12);
- make.centerY.equalTo(self.containerView);
- }];
- [self.editBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.containerView);
- make.height.equalTo(self.containerView);
- make.width.mas_equalTo(55);
- }];
- }
- - (void)fk_configWithViewModel:(id)viewModel indexPath:(NSIndexPath *)indexPath{
- if ([viewModel isKindOfClass:[FKMyCircleViewModel class]]) {
- FKMyCircleViewModel *myCircleModel = (FKMyCircleViewModel *)viewModel;
- FKMyCircleContentItem *contentItem = [myCircleModel circleContentItemAtIndex:indexPath.section - 1];
- self.timeLabel.text = [FLStringHelper convertToCommonFormateFromString:contentItem.shareItem.createTime baseTime:myCircleModel.serveTime];
- }
- }
- #pragma mark - property
- - (UILabel *)timeLabel{
- if (_timeLabel == nil) {
- _timeLabel = [[UILabel alloc]init];
- _timeLabel.textColor = UIColorFromRGB(0x9b9b9b);
- _timeLabel.font = [UIFont systemFontOfSize:13];
- }
- return _timeLabel;
- }
- - (UIButton *)editBtn{
- if (_editBtn == nil) {
- _editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- [_editBtn setImage:[UIImage imageNamed:@"myCircle_edit_btn"] forState:UIControlStateNormal];
- }
- return _editBtn;
- }
- - (UIView *)containerView{
- if (_containerView == nil) {
- _containerView = [[UIView alloc]init];
- _containerView.backgroundColor = [UIColor whiteColor];
- _containerView.layer.cornerRadius = 5;
- }
- return _containerView;
- }
- - (UIView *)coverLine{
- if (_coverLine == nil) {
- _coverLine = [[UIView alloc]init];
- _coverLine.backgroundColor = [UIColor whiteColor];
- }
- return _coverLine;
- }
- @end
|