Netease-Music-Demo by sss
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.

PopularSongCell.swift 1.7KB

3 jaren geleden
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //
  2. // PopularSongCell.swift
  3. // wyy
  4. //
  5. // Created by 施书顺 on 2021/3/5.
  6. //
  7. import UIKit
  8. import SnapKit
  9. class PopularSongCell: UICollectionViewCell {
  10. let width: CGFloat = 100.0
  11. let songLabel = UILabel()
  12. let authorLabel = UILabel()
  13. let commentLabel = UILabel()
  14. let albumImageView = UIImageView()
  15. override init(frame: CGRect){
  16. super.init(frame: frame)
  17. albumImageView.layer.cornerRadius = 8
  18. albumImageView.clipsToBounds = true
  19. addSubview(albumImageView)
  20. albumImageView.snp.makeConstraints{ make in
  21. make.left.equalTo(5)
  22. make.top.equalTo(5)
  23. make.width.equalTo(50)
  24. make.height.equalTo(50)
  25. }
  26. songLabel.font = UIFont.systemFont(ofSize: 18, weight: .medium)
  27. addSubview(songLabel)
  28. songLabel.snp.makeConstraints{ make in
  29. make.left.equalTo(albumImageView.snp.right).offset(10)
  30. make.top.equalTo(5)
  31. }
  32. authorLabel.font = UIFont.systemFont(ofSize: 13, weight: .light)
  33. authorLabel.textColor = UIColor.gray
  34. addSubview(authorLabel)
  35. authorLabel.snp.makeConstraints{ make in
  36. make.left.equalTo(songLabel.snp.right)
  37. make.top.equalTo(songLabel.snp.top).offset(5)
  38. }
  39. commentLabel.font = UIFont.systemFont(ofSize: 13, weight: .light)
  40. commentLabel.textColor = UIColor.gray
  41. addSubview(commentLabel)
  42. commentLabel.snp.makeConstraints{ make in
  43. make.top.equalTo(songLabel.snp.bottom).offset(5)
  44. make.left.equalTo(songLabel.snp.left)
  45. }
  46. }
  47. required init?(coder: NSCoder) {
  48. fatalError("init(coder:) has not been implemented")
  49. }
  50. }