IVTNewCollectionCell.m
1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// 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