-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBusinessCell.swift
57 lines (43 loc) · 1.63 KB
/
BusinessCell.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
//
// BusinessCell.swift
// Yelp
//
// Created by Andrei Gurau on 1/26/16.
// Copyright © 2016 Timothy Lee. All rights reserved.
//
import UIKit
class BusinessCell: UITableViewCell {
@IBOutlet weak var thumbImageView: UIImageView!
@IBOutlet weak var nameLabel: UILabel!
@IBOutlet weak var distanceLabel: UILabel!
@IBOutlet weak var reviewsCountLabel: UILabel!
@IBOutlet weak var ratingsImageView: UIImageView!
@IBOutlet weak var addressLabel: UILabel!
@IBOutlet weak var categoriesLabel: UILabel!
var business :Business! {
didSet{
nameLabel.text = business.name
thumbImageView.setImageWithURL(business.imageURL!)
categoriesLabel.text = business.categories
addressLabel.text = business.address
reviewsCountLabel.text = "\(business.reviewCount!) Reviews"
ratingsImageView.setImageWithURL(business.ratingImageURL!)
distanceLabel.text = business.distance
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
thumbImageView.layer.cornerRadius = 3
thumbImageView.clipsToBounds = true
nameLabel.preferredMaxLayoutWidth = nameLabel.frame.size.width
}
override func layoutSubviews() {
super.layoutSubviews()
nameLabel.preferredMaxLayoutWidth = nameLabel.frame.size.width
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}