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
//
// TAPImagePreviewCollectionViewCell.m
// TapTalk
//
// Created by Dominic Vedericho on 18/12/18.
// Copyright © 2018 Moselo. All rights reserved.
//
#import "TAPImagePreviewCollectionViewCell.h"
@interface TAPImagePreviewCollectionViewCell ()
@property (strong, nonatomic) UIImageView *selectedPictureImageView;
@end
@implementation TAPImagePreviewCollectionViewCell
#pragma mark - Lifecycle
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
_selectedPictureImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.contentView.frame), CGRectGetHeight(self.contentView.frame))];
self.selectedPictureImageView.contentMode = UIViewContentModeScaleAspectFit;
self.selectedPictureImageView.clipsToBounds = YES;
[self.contentView addSubview:self.selectedPictureImageView];
}
return self;
}
- (void)prepareForReuse {
[super prepareForReuse];
self.selectedPictureImageView.image = nil;
}
#pragma mark - Custom Method
- (void)setImagePreviewImage:(UIImage *)image {
self.selectedPictureImageView.image = image;
}
@end