NoPictureTableViewCell.m 2.14 KB
//
//  NoPictureTableViewCell.m
//  SCIOLiveCN
//
//  Created by huayu on 17/3/10.
//  Copyright © 2017年 huayu. All rights reserved.
//

#import "NoPictureTableViewCell.h"

@implementation NoPictureTableViewCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        _backGroundView = [[UIView alloc] initWithFrame:CGRectMake(12, 6, MainScreenWidth - 24, 8 + MainScreenWidth*5/24)];
        _backGroundView.backgroundColor = [UIColor whiteColor];
        [self addSubview:_backGroundView];

        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 6, MainScreenWidth - MainScreenWidth/3 - 38, MainScreenWidth*10/72)];
        _titleLabel.numberOfLines = 2;
        _titleLabel.textColor = HEXCOLOR(0x333333);
        _titleLabel.font = [UIFont systemFontOfSize:16];
        _titleLabel.backgroundColor = [UIColor clearColor];
        [self addSubview:_titleLabel];
        
        _timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 6 + MainScreenWidth*5/24 - 16, MainScreenWidth - MainScreenWidth/3 - 38, 16)];
        _timeLabel.textColor = HEXCOLOR(0x666666);
        _timeLabel.font = [UIFont systemFontOfSize:12];
        _timeLabel.backgroundColor = [UIColor clearColor];
        [self addSubview:_timeLabel];
        
        _tagsLabel = [[UILabel alloc] initWithFrame:CGRectMake(MainScreenWidth - 112, 6 + MainScreenWidth*5/24 - 16, 0, 16)];
        _tagsLabel.textColor = HEXCOLOR(0xFFFFFF);
        _tagsLabel.font = [UIFont systemFontOfSize:12];
        _tagsLabel.textAlignment = NSTextAlignmentCenter;
        _tagsLabel.backgroundColor = HEXCOLOR(0x195AC9);
        _tagsLabel.layer.masksToBounds = YES;
        _tagsLabel.layer.cornerRadius = 4.0;
        [self addSubview:_tagsLabel];
    }
    return self;
}
- (void)reSetTagFrame {
    CGRect frame = _tagsLabel.frame;
    [_tagsLabel sizeToFit];
    
    frame.size.width = _tagsLabel.frame.size.width + 10;
    frame.origin.x = MainScreenWidth - frame.size.width - 22;
    
    [_tagsLabel setFrame:frame];
}
@end