选集功能开发

This commit is contained in:
2025-04-22 18:05:38 +08:00
parent b30d9070d3
commit eaf21f656e
15 changed files with 65 additions and 93 deletions

View File

@ -144,5 +144,21 @@ extension UIColor {
static func colorAFB8BF(alpha: CGFloat = 1) -> UIColor {
return color(hex: 0xAFB8BF, alpha: alpha)
}
static func colorFF0000(alpha: CGFloat = 1) -> UIColor {
return color(hex: 0xFF0000, alpha: alpha)
}
static func color1C1A1C(alpha: CGFloat = 1) -> UIColor {
return color(hex: 0x1C1A1C, alpha: alpha)
}
static func color621C14(alpha: CGFloat = 1) -> UIColor {
return color(hex: 0x621C14, alpha: alpha)
}
static func color5A5C67(alpha: CGFloat = 1) -> UIColor {
return color(hex: 0x5A5C67, alpha: alpha)
}
}

View File

@ -18,29 +18,30 @@ class SPEpisodeCell: SPCollectionViewCell {
var sp_isSelected: Bool = false {
didSet {
textLabel.isHidden = sp_isSelected
playImageView.isHidden = !sp_isSelected
if sp_isSelected {
contentView.backgroundColor = .color621C14()
contentView.layer.borderColor = UIColor.colorFF0000().cgColor
} else {
contentView.backgroundColor = .color1C1A1C()
contentView.layer.borderColor = UIColor.color1C1A1C().cgColor
}
}
}
private lazy var textLabel: UILabel = {
let label = UILabel()
label.font = .fontLight(ofSize: 14)
label.textColor = .colorD2D2D2()
label.font = .fontMedium(ofSize: 16)
label.textColor = .colorFFFFFF()
return label
}()
private lazy var playImageView: UIImageView = {
let imageView = UIImageView(image: UIImage(named: "play_icon_01"))
return imageView
}()
override init(frame: CGRect) {
super.init(frame: frame)
contentView.backgroundColor = .colorFFFFFF(alpha: 0.14)
contentView.layer.cornerRadius = 7
contentView.layer.cornerRadius = 8
contentView.layer.masksToBounds = true
contentView.layer.borderWidth = 2
_setupUI()
@ -55,15 +56,11 @@ extension SPEpisodeCell {
private func _setupUI() {
contentView.addSubview(textLabel)
contentView.addSubview(playImageView)
textLabel.snp.makeConstraints { make in
make.center.equalToSuperview()
}
playImageView.snp.makeConstraints { make in
make.center.equalToSuperview()
}
}

View File

@ -10,7 +10,7 @@ import UIKit
class SPEpisodeMenuView: UIView {
override var intrinsicContentSize: CGSize {
return CGSize(width: kSPScreenWidth, height: 32)
return CGSize(width: kSPScreenWidth, height: 30)
}
var didSelectedIndex: ((_ index: Int) -> Void)?
@ -34,12 +34,13 @@ class SPEpisodeMenuView: UIView {
private lazy var buttonArr: [UIButton] = []
//MARK: UI
private lazy var progressView: SPGradientView = {
let view = SPGradientView()
view.colors = [UIColor.colorF56490().cgColor, UIColor.colorBF6BFF().cgColor]
view.startPoint = .init(x: 0, y: 0.5)
view.endPoint = .init(x: 1, y: 0.5)
view.locations = [0, 1]
private lazy var progressView: UIView = {
let view = UIView()
view.backgroundColor = .colorFF0000()
// view.colors = [UIColor.colorF56490().cgColor, UIColor.colorBF6BFF().cgColor]
// view.startPoint = .init(x: 0, y: 0.5)
// view.endPoint = .init(x: 1, y: 0.5)
// view.locations = [0, 1]
return view
}()
@ -71,19 +72,19 @@ class SPEpisodeMenuView: UIView {
dataArr.enumerated().forEach {
let normalStrig = NSMutableAttributedString(string: $1)
normalStrig.color = .color9D9D9D()
normalStrig.font = .fontLight(ofSize: 14)
normalStrig.color = .colorFFFFFF()
normalStrig.font = .fontMedium(ofSize: 12)
let selectedString = NSMutableAttributedString(string: $1)
selectedString.color = .colorF564B6()
selectedString.font = .fontMedium(ofSize: 14)
// let selectedString = NSMutableAttributedString(string: $1)
// selectedString.color = .colorF564B6()
// selectedString.font = .fontMedium(ofSize: 14)
let button = UIButton(type: .custom)
button.tag = $0
button.setAttributedTitle(normalStrig, for: .normal)
button.setAttributedTitle(selectedString, for: .selected)
button.setAttributedTitle(selectedString, for: [.selected, .highlighted])
// button.setAttributedTitle(selectedString, for: .selected)
// button.setAttributedTitle(selectedString, for: [.selected, .highlighted])
button.addTarget(self, action: #selector(handleButton), for: .touchUpInside)
button.isSelected = $0 == selectedIndex
@ -93,20 +94,20 @@ class SPEpisodeMenuView: UIView {
if previousButton == nil {
button.snp.makeConstraints { make in
make.top.left.equalToSuperview()
make.height.equalTo(32)
make.height.equalTo(30)
}
} else if let previousButton = previousButton, count - 1 == $0 {
button.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.equalTo(previousButton.snp.right).offset(25)
make.height.equalTo(32)
make.height.equalTo(30)
make.right.equalToSuperview()
}
} else if let previousButton = previousButton {
button.snp.makeConstraints { make in
make.top.equalToSuperview()
make.left.equalTo(previousButton.snp.right).offset(25)
make.height.equalTo(32)
make.height.equalTo(30)
}
}

View File

@ -68,13 +68,13 @@ class SPEpisodeView: HWPanModalContentView {
}()
private lazy var collectionViewLayout: UICollectionViewFlowLayout = {
let itemWidth = floor((kSPScreenWidth - 10 * 4 - 30) / 5)
let itemWidth = floor((kSPScreenWidth - 7 * 4 - 32) / 5)
let layout = UICollectionViewFlowLayout()
layout.itemSize = .init(width: itemWidth, height: 50)
layout.minimumLineSpacing = 10
layout.minimumInteritemSpacing = 10
layout.sectionInset = .init(top: 0, left: 15, bottom: 0, right: 15)
layout.itemSize = .init(width: itemWidth, height: 54)
layout.minimumLineSpacing = 7
layout.minimumInteritemSpacing = 7
layout.sectionInset = .init(top: 0, left: 16, bottom: 0, right: 16)
return layout
}()
@ -88,8 +88,8 @@ class SPEpisodeView: HWPanModalContentView {
private lazy var indicatorView: UIView = {
let view = UIView()
view.backgroundColor = .colorFFFFFF()
view.layer.cornerRadius = 2
view.backgroundColor = .color5A5C67()
view.layer.cornerRadius = 2.5
view.layer.masksToBounds = true
return view
}()
@ -105,8 +105,9 @@ class SPEpisodeView: HWPanModalContentView {
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.font = .fontMedium(ofSize: 14)
label.font = .fontBold(ofSize: 14)
label.textColor = .colorFFFFFF()
label.numberOfLines = 2
return label
}()
@ -200,9 +201,9 @@ extension SPEpisodeView {
self.indicatorView.snp.makeConstraints { make in
make.centerX.equalToSuperview()
make.top.equalToSuperview().offset(15)
make.width.equalTo(30)
make.height.equalTo(4)
make.top.equalToSuperview().offset(10)
make.width.equalTo(40)
make.height.equalTo(5)
}
self.coverImageView.snp.makeConstraints { make in
@ -220,8 +221,9 @@ extension SPEpisodeView {
self.desLabel.snp.makeConstraints { make in
make.left.equalTo(self.titleLabel)
make.right.lessThanOrEqualToSuperview().offset(-15)
make.top.equalTo(self.coverImageView.snp.bottom).offset(8)
make.right.lessThanOrEqualToSuperview().offset(-16)
// make.top.equalTo(self.coverImageView.snp.bottom).offset(8)
make.top.equalTo(titleLabel.snp.bottom).offset(6)
}
self.menuView.snp.makeConstraints { make in
@ -230,9 +232,9 @@ extension SPEpisodeView {
}
self.lineView.snp.makeConstraints { make in
make.left.equalToSuperview().offset(15)
make.left.equalToSuperview().offset(16)
make.centerX.equalToSuperview()
make.top.equalTo(self.desLabel.snp.bottom).offset(46)
make.top.equalTo(self.coverImageView.snp.bottom).offset(46)
make.height.equalTo(0.7)
}

View File

@ -1,22 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "路径 497@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "路径 497@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1,22 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "play1@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "play1@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "背景@2x.png",
"filename" : "背景@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "背景@3x.png",
"filename" : "背景@3x.png",
"idiom" : "universal",
"scale" : "3x"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 554 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 KiB