From 7c6c9b5e7963b6e1dfd6bb68463e469a1012307c Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Wed, 10 Jul 2024 13:52:56 +0200 Subject: [PATCH] Use SymbolConfigurations for buttons (IOS-241) I feel so stupid from time to time --- .../NotificationFilteringBannerTableViewCell.swift | 6 +++--- .../Policy/NotificationPolicyHeaderView.swift | 11 ++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Mastodon/Scene/Notification/Cell/NotificationFilteringBannerTableViewCell.swift b/Mastodon/Scene/Notification/Cell/NotificationFilteringBannerTableViewCell.swift index 9eb3d5b43..8892c12d5 100644 --- a/Mastodon/Scene/Notification/Cell/NotificationFilteringBannerTableViewCell.swift +++ b/Mastodon/Scene/Notification/Cell/NotificationFilteringBannerTableViewCell.swift @@ -19,7 +19,9 @@ class NotificationFilteringBannerTableViewCell: UITableViewCell { override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { - iconImageView = UIImageView(image: UIImage(systemName: "archivebox")) + let iconConfiguration = UIImage.SymbolConfiguration(scale: .large) + let icon = UIImage(systemName: "archivebox", withConfiguration: iconConfiguration) + iconImageView = UIImageView(image: icon) iconImageView.translatesAutoresizingMaskIntoConstraints = false iconImageWrapperView = UIView() @@ -67,8 +69,6 @@ class NotificationFilteringBannerTableViewCell: UITableViewCell { iconImageWrapperView.heightAnchor.constraint(equalToConstant: CGSize.authorAvatarButtonSize.height).priority(.defaultHigh), iconImageView.centerXAnchor.constraint(equalTo: iconImageWrapperView.centerXAnchor), iconImageView.centerYAnchor.constraint(equalTo: iconImageWrapperView.centerYAnchor), - iconImageView.widthAnchor.constraint(equalToConstant: 27), - iconImageView.heightAnchor.constraint(equalToConstant: 24), contentStackView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 8), contentStackView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 16), diff --git a/Mastodon/Scene/Notification/Notification Filtering/Policy/NotificationPolicyHeaderView.swift b/Mastodon/Scene/Notification/Notification Filtering/Policy/NotificationPolicyHeaderView.swift index f5a93733d..2d6e2fa77 100644 --- a/Mastodon/Scene/Notification/Notification Filtering/Policy/NotificationPolicyHeaderView.swift +++ b/Mastodon/Scene/Notification/Notification Filtering/Policy/NotificationPolicyHeaderView.swift @@ -14,10 +14,15 @@ class NotificationPolicyHeaderView: UIView { // TODO: Localization titleLabel.text = "Filter Notifications from..." - closeButton = UIButton() - closeButton.setImage(UIImage(systemName: "xmark.circle.fill"), for: .normal) + + let buttonImageConfiguration = UIImage.SymbolConfiguration(scale: .large) + let buttonImage = UIImage(systemName: "xmark.circle.fill", withConfiguration: buttonImageConfiguration) + var buttonConfiguration = UIButton.Configuration.plain() + buttonConfiguration.image = buttonImage + buttonConfiguration.contentInsets = .init(top: 10, leading: 10, bottom: 10, trailing: 10) + + closeButton = UIButton(configuration: buttonConfiguration) closeButton.translatesAutoresizingMaskIntoConstraints = false - closeButton.setInsets(forContentPadding: UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10), imageTitlePadding: 0) closeButton.contentMode = .center super.init(frame: frame)