|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- //
- // PopularSongCell.swift
- // wyy
- //
- // Created by 施书顺 on 2021/3/5.
- //
-
- import UIKit
- import SnapKit
-
- class PopularSongCell: UICollectionViewCell {
- let width: CGFloat = 100.0
-
- let songLabel = UILabel()
- let authorLabel = UILabel()
- let commentLabel = UILabel()
- let albumImageView = UIImageView()
-
- override init(frame: CGRect){
- super.init(frame: frame)
- albumImageView.layer.cornerRadius = 8
- albumImageView.clipsToBounds = true
- addSubview(albumImageView)
- albumImageView.snp.makeConstraints{ make in
- make.left.equalTo(5)
- make.top.equalTo(5)
- make.width.equalTo(50)
- make.height.equalTo(50)
- }
-
- songLabel.font = UIFont.systemFont(ofSize: 18, weight: .medium)
- addSubview(songLabel)
- songLabel.snp.makeConstraints{ make in
- make.left.equalTo(albumImageView.snp.right).offset(10)
- make.top.equalTo(5)
- }
-
- authorLabel.font = UIFont.systemFont(ofSize: 13, weight: .light)
- authorLabel.textColor = UIColor.gray
- addSubview(authorLabel)
- authorLabel.snp.makeConstraints{ make in
- make.left.equalTo(songLabel.snp.right)
- make.top.equalTo(songLabel.snp.top).offset(5)
- }
-
- commentLabel.font = UIFont.systemFont(ofSize: 13, weight: .light)
- commentLabel.textColor = UIColor.gray
- addSubview(commentLabel)
- commentLabel.snp.makeConstraints{ make in
- make.top.equalTo(songLabel.snp.bottom).offset(5)
- make.left.equalTo(songLabel.snp.left)
- }
- }
-
- required init?(coder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
- }
|