Update checkmark to match the new design (#690)

This commit is contained in:
Nathan Mattes 2022-12-14 22:09:57 +01:00
parent f2e419412b
commit ffe3b10f3c
1 changed files with 8 additions and 10 deletions

View File

@ -37,7 +37,6 @@ class PickServerCell: UITableViewCell {
let checkbox: UIImageView = { let checkbox: UIImageView = {
let imageView = UIImageView() let imageView = UIImageView()
imageView.preferredSymbolConfiguration = UIImage.SymbolConfiguration(textStyle: .body) imageView.preferredSymbolConfiguration = UIImage.SymbolConfiguration(textStyle: .body)
imageView.tintColor = Asset.Colors.Label.secondary.color
imageView.contentMode = .scaleAspectFill imageView.contentMode = .scaleAspectFill
imageView.translatesAutoresizingMaskIntoConstraints = false imageView.translatesAutoresizingMaskIntoConstraints = false
return imageView return imageView
@ -83,17 +82,17 @@ extension PickServerCell {
checkbox.translatesAutoresizingMaskIntoConstraints = false checkbox.translatesAutoresizingMaskIntoConstraints = false
contentView.addSubview(checkbox) contentView.addSubview(checkbox)
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
checkbox.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor, constant: 1), contentView.readableContentGuide.trailingAnchor.constraint(equalTo: checkbox.trailingAnchor, constant: 16),
checkbox.heightAnchor.constraint(equalToConstant: 32).priority(.required - 1), checkbox.heightAnchor.constraint(equalToConstant: 20),
checkbox.widthAnchor.constraint(equalToConstant: 32).priority(.required - 1), checkbox.widthAnchor.constraint(equalTo: checkbox.heightAnchor),
]) ])
containerView.translatesAutoresizingMaskIntoConstraints = false containerView.translatesAutoresizingMaskIntoConstraints = false
contentView.addSubview(containerView) contentView.addSubview(containerView)
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
containerView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 11), containerView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 11),
containerView.leadingAnchor.constraint(equalTo: checkbox.trailingAnchor, constant: 22), containerView.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor, constant: 16),
containerView.trailingAnchor.constraint(equalTo: contentView.readableContentGuide.trailingAnchor), checkbox.leadingAnchor.constraint(equalTo: containerView.trailingAnchor, constant: 16),
contentView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor, constant: 11), contentView.bottomAnchor.constraint(equalTo: containerView.bottomAnchor, constant: 11),
checkbox.centerYAnchor.constraint(equalTo: containerView.centerYAnchor), checkbox.centerYAnchor.constraint(equalTo: containerView.centerYAnchor),
]) ])
@ -106,11 +105,10 @@ extension PickServerCell {
override func setSelected(_ selected: Bool, animated: Bool) { override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated) super.setSelected(selected, animated: animated)
if selected { if selected {
checkbox.image = UIImage(systemName: "checkmark.circle.fill") checkbox.image = UIImage(systemName: "checkmark")
checkbox.tintColor = Asset.Colors.Label.primary.color checkbox.tintColor = Asset.Colors.brand.color
} else { } else {
checkbox.image = UIImage(systemName: "circle") checkbox.image = nil
checkbox.tintColor = Asset.Colors.Label.secondary.color
} }
} }