移除颜色单词列表的颜色圆点

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-07-19 21:57:40 +08:00
parent 152dcd9aac
commit 0007459eef
5 changed files with 22 additions and 82 deletions
@@ -1,28 +0,0 @@
import UIKit
final class ColorDotView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
layer.borderWidth = 1
updateBorder()
}
@available(*, unavailable)
required init?(coder: NSCoder) { fatalError() }
override func layoutSubviews() {
super.layoutSubviews()
layer.cornerRadius = bounds.width / 2
}
override func traitCollectionDidChange(_ previous: UITraitCollection?) {
super.traitCollectionDidChange(previous)
if traitCollection.hasDifferentColorAppearance(comparedTo: previous) {
updateBorder()
}
}
private func updateBorder() {
layer.borderColor = UIColor.label.withAlphaComponent(0.15).cgColor
}
}
@@ -2,7 +2,6 @@ import UIKit
final class WordCardCell: UITableViewCell {
private let cardView = UIView()
private let colorDot = ColorDotView()
private let wordLabel = UILabel()
private let phoneticLabel = UILabel()
private let meaningLabel = UILabel()
@@ -34,19 +33,7 @@ final class WordCardCell: UITableViewCell {
meaningLabel.font = .preferredFont(forTextStyle: .subheadline)
meaningLabel.textColor = .secondaryLabel
let wordRowSpacer = UIView()
wordRowSpacer.setContentHuggingPriority(.init(1), for: .horizontal)
let wordRow = UIStackView(arrangedSubviews: [wordLabel, colorDot, wordRowSpacer])
wordRow.axis = .horizontal
wordRow.alignment = .center
wordRow.spacing = 8
colorDot.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
colorDot.widthAnchor.constraint(equalToConstant: 12),
colorDot.heightAnchor.constraint(equalToConstant: 12)
])
let textStack = UIStackView(arrangedSubviews: [wordRow, phoneticLabel, meaningLabel])
let textStack = UIStackView(arrangedSubviews: [wordLabel, phoneticLabel, meaningLabel])
textStack.axis = .vertical
textStack.spacing = 8
@@ -81,8 +68,6 @@ final class WordCardCell: UITableViewCell {
wordLabel.text = word.word
phoneticLabel.text = word.phonetic
meaningLabel.text = word.meaning
colorDot.backgroundColor = word.color
colorDot.isHidden = word.color == nil
updateSpeakerState()
}