Netease-Music-Demo by sss
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

SideBarCell.swift 1.8KB

před 3 roky
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // SideBarCell.swift
  3. // wyy
  4. //
  5. // Created by 施书顺 on 2021/3/6.
  6. //
  7. import UIKit
  8. import SnapKit
  9. class SideBarCell: UITableViewCell {
  10. let iconRadius: CGFloat = 10
  11. let iconImageView = UIImageView()
  12. let titleLabel = UILabel()
  13. let continueLabel = UILabel()
  14. override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  15. super.init(style: style, reuseIdentifier: reuseIdentifier)
  16. contentView.addSubview(iconImageView)
  17. iconImageView.contentMode = .scaleAspectFit
  18. iconImageView.snp.makeConstraints{ make in
  19. make.width.equalTo(iconRadius * 2)
  20. make.height.equalTo(iconRadius * 2)
  21. make.left.equalTo(10)
  22. make.centerY.equalToSuperview()
  23. }
  24. contentView.addSubview(titleLabel)
  25. titleLabel.textColor = .black
  26. titleLabel.font = UIFont.systemFont(ofSize: 10)
  27. titleLabel.textAlignment = .left
  28. titleLabel.snp.makeConstraints{ make in
  29. make.left.equalTo(iconImageView.snp.right).offset(10)
  30. make.centerY.equalToSuperview()
  31. }
  32. contentView.addSubview(continueLabel)
  33. continueLabel.text = ">"
  34. continueLabel.textColor = .black
  35. continueLabel.font = UIFont.systemFont(ofSize: 10, weight: .light)
  36. continueLabel.snp.makeConstraints{ make in
  37. make.right.equalTo(10)
  38. make.centerY.equalToSuperview()
  39. }
  40. }
  41. required init?(coder: NSCoder) {
  42. fatalError("init(coder:) has not been implemented")
  43. }
  44. override func awakeFromNib() {
  45. super.awakeFromNib()
  46. // Initialization code
  47. }
  48. override func setSelected(_ selected: Bool, animated: Bool) {
  49. super.setSelected(selected, animated: animated)
  50. // Configure the view for the selected state
  51. }
  52. }