You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.3 KiB
46 lines
1.3 KiB
//
|
|
// RecipientListTableViewCell.swift
|
|
// GMERemittance
|
|
//
|
|
// Created by Fm-user on 12/21/17.
|
|
// Copyright © 2017 Gobal Money Express Co. Ltd. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class RecipientListTableViewCell: UITableViewCell {
|
|
|
|
@IBOutlet weak var labelInitial: UILabel!
|
|
@IBOutlet weak var labelRecipientName: UILabel!
|
|
|
|
var model: Recipient?
|
|
|
|
override func awakeFromNib() {
|
|
super.awakeFromNib()
|
|
// Initialization code
|
|
}
|
|
|
|
|
|
func setup() {
|
|
let name = model?.getFullName()
|
|
labelRecipientName.text = name
|
|
|
|
labelInitial.text = name?.prefix(1).uppercased()
|
|
labelInitial.layer.cornerRadius = labelInitial.frame.size.width/2
|
|
labelInitial.backgroundColor = getRandomColor()
|
|
|
|
layer.borderColor = UIColor(red:0.91, green:0.93, blue:0.95, alpha:1.0).cgColor
|
|
layer.borderWidth = 1
|
|
layer.cornerRadius = 10
|
|
clipsToBounds = true
|
|
}
|
|
|
|
private func getRandomColor() -> UIColor{
|
|
//Generate between 0 to 1
|
|
let red: CGFloat = CGFloat(drand48())
|
|
let green: CGFloat = CGFloat(drand48())
|
|
let blue: CGFloat = CGFloat(drand48())
|
|
return UIColor(red:red, green: green, blue: blue, alpha: 1.0)
|
|
}
|
|
|
|
}
|