IVTNewCollectionCell.m 1.77 KB
//
//  IVTNewCollectionCell.m
//  IVTMeLiveTwo
//
//  Created by xrg on 16/8/25.
//  Copyright © 2016年 QLQ. All rights reserved.
//

#import "IVTNewCollectionCell.h"

@implementation IVTNewCollectionCell
-(id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self prepareUI];
    }
    return self;
    
}

-(void)prepareUI{
    
    //    self.contentView.frame = CGRectMake(0, 0,37*10, 40);
    
    self.userHeadImageView = [[UIImageView alloc]init];
    self.userHeadImageView.userInteractionEnabled = YES;
    [self.contentView addSubview:self.userHeadImageView];
    [self.userHeadImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
    
    
    /// 点击事件
    CGFloat screenwidth= ([UIScreen mainScreen].bounds.size.width-24) / 3.0;
    CGFloat screenHeight = [UIScreen mainScreen].bounds.size.height;
    CGFloat itemHeight;
    if(screenHeight == 568.0){
        itemHeight = 80;
        
    }else  if(screenHeight == 667.0){
        itemHeight = 89;
        
    }else{
        itemHeight = 100;
    }
}

- (void)setVideoNewModel:(IVTNewVideoModel *)VideoNewModel
{
    [_userHeadImageView sd_setImageWithURL:[NSURL URLWithString:VideoNewModel.avatarUrl] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        _userHeadImageView.alpha = 0.0;
        [UIView transitionWithView:_userHeadImageView
                          duration:1.0
                           options:UIViewAnimationOptionTransitionCrossDissolve
                        animations:^{
                            [_userHeadImageView setImage:image];
                            _userHeadImageView.alpha = 1.0;
                        } completion:NULL];
    }];
}

@end