-
Notifications
You must be signed in to change notification settings - Fork 0
/
TweetCell.swift
59 lines (47 loc) · 1.93 KB
/
TweetCell.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
51
52
53
54
55
56
57
58
59
//
// TweetCell.swift
// SmartStream
//
// Created by Jerry on 3/16/16.
// Copyright © 2016 SmartStream. All rights reserved.
//
import UIKit
class TweetCell: UITableViewCell {
@IBOutlet weak var AvatarImageView: UIImageView!
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var usernameLabel: UILabel!
@IBOutlet weak var tweetContentLabel: UILabel!
@IBOutlet weak var tweetBackgroundView: UIView!
@IBOutlet weak var tweetDateLabel: UILabel!
let clearColor = UIColor.clearColor()
let tweetContentColor = UIColor.whiteColor()
var tweet: Tweet! {
didSet {
let avatarUrl = NSURL(string: tweet.user!.profileImageUrl!)
AvatarImageView.setImageWithURL(avatarUrl!, placeholderImage: UIImage(named: "placeholder"))
nameLabel.text = tweet.user!.name
usernameLabel.text = "@\(tweet.user!.screenname!)"
tweetContentLabel.text = tweet.text
tweetDateLabel.text = DateManager.getFriendlyTime(tweet.createdAt!)
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
backgroundColor = clearColor
contentView.backgroundColor = clearColor
tweetBackgroundView.backgroundColor = Theme.Colors.LightBackgroundColor.color
tweetBackgroundView.layer.opacity = 0.6
nameLabel.textColor = Theme.Colors.HighlightLightColor.color
usernameLabel.textColor = Theme.Colors.HighlightLightColor.color
tweetContentLabel.textColor = tweetContentColor
AvatarImageView.layer.cornerRadius = 4
AvatarImageView.clipsToBounds = true
tweetBackgroundView.layer.cornerRadius = 4
tweetBackgroundView.clipsToBounds = true
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}