-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUserTableViewCell.swift
50 lines (35 loc) · 1.19 KB
/
UserTableViewCell.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
42
43
44
45
46
47
48
49
50
//
// UserTableViewCell.swift
// RandomUser
//
// Created by Ayuna NYC on 1/9/17.
// Copyright © 2017 Ayuna NYC. All rights reserved.
//
import UIKit
class UserTableViewCell: UITableViewCell {
@IBOutlet weak var avatarView: UIImageView!
@IBOutlet weak var nameLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
}
override func layoutSubviews() {
super.layoutSubviews()
updateCornerRadii()
}
func updateCornerRadii() {
let radius = self.avatarView.frame.size.width / 2.0
self.avatarView.layer.cornerRadius = radius
avatarView.clipsToBounds = true
}
func updateWithImage(image: UIImage) {
avatarView.alpha = 0
UIView.animate(withDuration: 0.5,
delay: 0,
options: UIViewAnimationOptions.showHideTransitionViews,
animations: { () -> Void in
self.avatarView.image = image
self.avatarView.alpha = 1
}, completion: { (Bool) -> Void in
})
}
}