DK
Size: a a a
DK
В
DK
RankingTableCell: UITableViewCell{
var ranking:Ranking?{
didSet{
guard let userImage = ranking?.userImage,let value = ranking?.value,let userPlaceString = ranking?.userPlace,let coeficient = ranking?.userCoeficient else {return}
userImageView.image = UIImage(named: userImage)
userValue.text = String(value)
userPlace.text = userPlaceString
progressView.frame = CGRect(x: 0, y: 0, width: coeficient, height: 30)
}
}
let userImageView = UIImageView(image: UIImage(), contentMode: .scaleAspectFit)
let userPlace = UILabel(text: "", font: UIFont.systemFont(ofSize: 13), textColor: .black, textAlignment: .left, numberOfLines: 0)
let progressView = UIView(backgroundColor: UIColor.blue)
let userValue = UILabel(text: "", font: UIFont.systemFont(ofSize: 13), textColor: .black, textAlignment: .left, numberOfLines: 0)
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
backgroundColor = UIColor(named: "backgroundColor")
[userPlace,userImageView,progressView,userValue].forEach{contentView.addSubview($0)}
userImageView.layer.cornerRadius = userImageView.frame.width / 2
userPlace.anchor(centerX: nil, centerY: contentView.centerYAnchor, top: nil, left: contentView.leftAnchor, bottom: nil, right: nil, paddingTop: 0, paddingLeft: 10, paddingBottom: 0, paddingRight: 0, width: 0, height: 0, enableInsets: false)
userImageView.anchor(centerX: nil, centerY: userPlace.centerYAnchor, top: nil, left: userPlace.rightAnchor, bottom: nil, right: nil, paddingTop: 0, paddingLeft: 10, paddingBottom: 0, paddingRight: 0, width: 30, height: 30, enableInsets: false)
progressView.anchor(centerX: nil, centerY: userPlace.centerYAnchor, top: nil, left: userImageView.rightAnchor, bottom: nil, right: nil, paddingTop: 0, paddingLeft: 10, paddingBottom: 0, paddingRight: 0, width: progressView.frame.width, height: 30, enableInsets: false)
userValue.anchor(centerX: nil, centerY: userPlace.centerYAnchor, top: nil, left: progressView.rightAnchor, bottom: nil, right: nil, paddingTop: 0, paddingLeft: 10, paddingBottom: 0, paddingRight: 0, width: 0, height: 30, enableInsets: false)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
} В
RankingTableCell: UITableViewCell{
var ranking:Ranking?{
didSet{
guard let userImage = ranking?.userImage,let value = ranking?.value,let userPlaceString = ranking?.userPlace,let coeficient = ranking?.userCoeficient else {return}
userImageView.image = UIImage(named: userImage)
userValue.text = String(value)
userPlace.text = userPlaceString
progressView.frame = CGRect(x: 0, y: 0, width: coeficient, height: 30)
}
}
let userImageView = UIImageView(image: UIImage(), contentMode: .scaleAspectFit)
let userPlace = UILabel(text: "", font: UIFont.systemFont(ofSize: 13), textColor: .black, textAlignment: .left, numberOfLines: 0)
let progressView = UIView(backgroundColor: UIColor.blue)
let userValue = UILabel(text: "", font: UIFont.systemFont(ofSize: 13), textColor: .black, textAlignment: .left, numberOfLines: 0)
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
backgroundColor = UIColor(named: "backgroundColor")
[userPlace,userImageView,progressView,userValue].forEach{contentView.addSubview($0)}
userImageView.layer.cornerRadius = userImageView.frame.width / 2
userPlace.anchor(centerX: nil, centerY: contentView.centerYAnchor, top: nil, left: contentView.leftAnchor, bottom: nil, right: nil, paddingTop: 0, paddingLeft: 10, paddingBottom: 0, paddingRight: 0, width: 0, height: 0, enableInsets: false)
userImageView.anchor(centerX: nil, centerY: userPlace.centerYAnchor, top: nil, left: userPlace.rightAnchor, bottom: nil, right: nil, paddingTop: 0, paddingLeft: 10, paddingBottom: 0, paddingRight: 0, width: 30, height: 30, enableInsets: false)
progressView.anchor(centerX: nil, centerY: userPlace.centerYAnchor, top: nil, left: userImageView.rightAnchor, bottom: nil, right: nil, paddingTop: 0, paddingLeft: 10, paddingBottom: 0, paddingRight: 0, width: progressView.frame.width, height: 30, enableInsets: false)
userValue.anchor(centerX: nil, centerY: userPlace.centerYAnchor, top: nil, left: progressView.rightAnchor, bottom: nil, right: nil, paddingTop: 0, paddingLeft: 10, paddingBottom: 0, paddingRight: 0, width: 0, height: 30, enableInsets: false)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
} DK
MP
DK
DK
В
В
В
DK
В
DK
DK
DK
MP
В
progressView.frame.width