forked from seedante/CardAnimation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImageCardView.swift
41 lines (35 loc) · 1.07 KB
/
ImageCardView.swift
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
//
// CardView.swift
// CardAnimation
//
// Created by Luis Sanchez Garcia on 16/10/15.
// Copyright © 2015 seedante. All rights reserved.
//
import UIKit
public class ImageCardView: BaseCardView {
var imageView:UIImageView!
override init(frame: CGRect) {
super.init(frame: frame)
configure()
}
required public init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
configure()
}
private func configure() {
backgroundColor = UIColor.darkGrayColor()
imageView = UIImageView(frame: frame)
imageView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
imageView.backgroundColor = UIColor.lightGrayColor()
imageView.clipsToBounds = true
imageView.contentMode = .ScaleAspectFill
addSubview(imageView)
}
//hidden property can't be animationable, I recommand using alpha.
override func contentVisible(visible:Bool) {
imageView.alpha = visible ? 1.0 : 0.0
}
override func prepareForReuse() {
imageView.hidden = false
}
}