From 514423a829b10d6a45bacbbc437e3afe940ea068 Mon Sep 17 00:00:00 2001 From: Valery Lozko Date: Mon, 25 Mar 2024 11:26:33 -0400 Subject: [PATCH] [ios] fix: Text trimming on the Menu screen on small screen #7605 Signed-off-by: Valery Lozko --- .../UI/BottomMenu/Menu/Cells/BottomMenuItemCell.swift | 11 +++++++++++ .../UI/BottomMenu/Menu/Cells/BottomMenuItemCell.xib | 2 ++ 2 files changed, 13 insertions(+) diff --git a/iphone/Maps/UI/BottomMenu/Menu/Cells/BottomMenuItemCell.swift b/iphone/Maps/UI/BottomMenu/Menu/Cells/BottomMenuItemCell.swift index e7e3f83cd4..b59332d089 100644 --- a/iphone/Maps/UI/BottomMenu/Menu/Cells/BottomMenuItemCell.swift +++ b/iphone/Maps/UI/BottomMenu/Menu/Cells/BottomMenuItemCell.swift @@ -6,6 +6,8 @@ class BottomMenuItemCell: UITableViewCell { @IBOutlet private var badgeCountLabel: UILabel! @IBOutlet private var separator: UIView! @IBOutlet private var icon: UIImageView! + @IBOutlet private var badgeSpacingConstraint: NSLayoutConstraint! + @IBOutlet private var badgeBackgroundWidthConstraint: NSLayoutConstraint! var anchorView: UIView { get { return icon @@ -20,6 +22,13 @@ class BottomMenuItemCell: UITableViewCell { label.text = title badgeBackground.isHidden = badgeCount == 0 badgeCountLabel.text = "\(badgeCount)" + if badgeCount == 0 { + badgeSpacingConstraint.constant = 0 + badgeBackgroundWidthConstraint.constant = 0 + } else { + badgeSpacingConstraint.constant = 8 + badgeBackgroundWidthConstraint.constant = 32 + } isEnabled = enabled icon.setStyleAndApply(isEnabled ? "MWMBlack" : "MWMGray") label.setStyleAndApply(isEnabled ? "blackPrimaryText" : "blackHintText") @@ -31,6 +40,8 @@ class BottomMenuItemCell: UITableViewCell { icon.setStyleAndApply("MWMBlue") label.setStyleAndApply("linkBlueText") badgeBackground.isHidden = true + badgeSpacingConstraint.constant = 0 + badgeBackgroundWidthConstraint.constant = 0 isEnabled = true isPromo = true } diff --git a/iphone/Maps/UI/BottomMenu/Menu/Cells/BottomMenuItemCell.xib b/iphone/Maps/UI/BottomMenu/Menu/Cells/BottomMenuItemCell.xib index cc816db742..67bf1dd2b7 100644 --- a/iphone/Maps/UI/BottomMenu/Menu/Cells/BottomMenuItemCell.xib +++ b/iphone/Maps/UI/BottomMenu/Menu/Cells/BottomMenuItemCell.xib @@ -91,7 +91,9 @@ + +