-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImagePreviewTableViewCell.swift
More file actions
executable file
·44 lines (33 loc) · 1.26 KB
/
ImagePreviewTableViewCell.swift
File metadata and controls
executable file
·44 lines (33 loc) · 1.26 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
//
// ImagePreviewTableViewCell.swift
// ImagePickerSheet
//
// Created by Laurin Brandner on 06/09/14.
// Copyright (c) 2014 Laurin Brandner. All rights reserved.
//
import UIKit
class ImagePreviewTableViewCell : UITableViewCell {
var collectionView: ImagePickerCollectionView? {
willSet {
if let collectionView = collectionView {
collectionView.removeFromSuperview()
}
if let collectionView = newValue {
addSubview(collectionView)
}
}
}
// MARK: - Other Methods
override func prepareForReuse() {
collectionView = nil
}
// MARK: - Layout
override func layoutSubviews() {
super.layoutSubviews()
// Setting the frame of the collectionView this large avoids a small animation glitch when resizing the previews. You'll get a beer from @larcus94 if you'll get it to work without this workaround :)
if let collectionView = collectionView {
collectionView.frame = CGRect(x: -bounds.width, y: bounds.minY, width: bounds.width*3, height: bounds.height)
collectionView.contentInset = UIEdgeInsetsMake(0.0, bounds.width, 0.0, bounds.width)
}
}
}