Skip to content

Commit 2a0504e

Browse files
committed
Fix warnings in BloggingPromptsHeaderView.xib
1 parent e651f2d commit 2a0504e

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

WordPress/Classes/ViewRelated/System/Action Sheet/BloggingPromptsHeaderView.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ private extension BloggingPromptsHeaderView {
3636
configureStrings()
3737
configureStyles()
3838
configureConstraints()
39+
configureInsets()
3940
}
4041

4142
func configureSpacing() {
@@ -55,11 +56,14 @@ private extension BloggingPromptsHeaderView {
5556

5657
func configureStyles() {
5758
titleLabel.font = WPStyleGuide.fontForTextStyle(.subheadline, fontWeight: .semibold)
59+
titleLabel.adjustsFontForContentSizeCategory = true
5860
promptLabel.font = WPStyleGuide.BloggingPrompts.promptContentFont
61+
promptLabel.adjustsFontForContentSizeCategory = true
5962
answerPromptButton.titleLabel?.font = WPStyleGuide.BloggingPrompts.buttonTitleFont
6063
answerPromptButton.titleLabel?.adjustsFontForContentSizeCategory = true
6164
answerPromptButton.setTitleColor(WPStyleGuide.BloggingPrompts.buttonTitleColor, for: .normal)
6265
answeredLabel.font = WPStyleGuide.BloggingPrompts.buttonTitleFont
66+
answeredLabel.adjustsFontForContentSizeCategory = true
6367
answeredLabel.textColor = WPStyleGuide.BloggingPrompts.answeredLabelColor
6468
shareButton.titleLabel?.font = WPStyleGuide.BloggingPrompts.buttonTitleFont
6569
shareButton.titleLabel?.adjustsFontForContentSizeCategory = true
@@ -73,12 +77,26 @@ private extension BloggingPromptsHeaderView {
7377
])
7478
}
7579

80+
func configureInsets() {
81+
if #available(iOS 15.0, *) {
82+
var config: UIButton.Configuration = .plain()
83+
config.contentInsets = Constants.buttonContentInsets
84+
answerPromptButton.configuration = config
85+
shareButton.configuration = config
86+
} else {
87+
answerPromptButton.contentEdgeInsets = Constants.buttonContentEdgeInsets
88+
shareButton.contentEdgeInsets = Constants.buttonContentEdgeInsets
89+
}
90+
}
91+
7692
// MARK: - Constants
7793

7894
struct Constants {
7995
static let titleSpacing: CGFloat = 8.0
8096
static let answeredViewSpacing: CGFloat = 9.0
8197
static let answerPromptButtonSpacing: CGFloat = 9.0
98+
static let buttonContentEdgeInsets = UIEdgeInsets(top: 16.0, left: 0.0, bottom: 16.0, right: 0.0)
99+
static let buttonContentInsets = NSDirectionalEdgeInsets(top: 16.0, leading: 0.0, bottom: 16.0, trailing: 0.0)
82100
}
83101

84102
struct Strings {

WordPress/Classes/ViewRelated/System/Action Sheet/BloggingPromptsHeaderView.xib

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<constraint firstAttribute="height" constant="18" id="Wgm-8p-3As"/>
2828
</constraints>
2929
</imageView>
30-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="Prompts" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BJN-uB-YYG">
30+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="Prompts" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BJN-uB-YYG">
3131
<rect key="frame" x="23" y="0.0" width="64.5" height="24"/>
3232
<constraints>
3333
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="24" id="5Im-WR-keg"/>
@@ -38,7 +38,7 @@
3838
</label>
3939
</subviews>
4040
</stackView>
41-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="Cast the movie of your life." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Rye-vB-0gG">
41+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="Cast the movie of your life." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Rye-vB-0gG">
4242
<rect key="frame" x="73.5" y="24" width="202.5" height="24"/>
4343
<constraints>
4444
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="24" id="XJS-Qq-aST"/>
@@ -48,30 +48,26 @@
4848
<nil key="highlightedColor"/>
4949
</label>
5050
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fqk-gy-gv5">
51-
<rect key="frame" x="125" y="48" width="99" height="23.5"/>
51+
<rect key="frame" x="113" y="48" width="123" height="23.5"/>
5252
<state key="normal" title="Button"/>
53-
<buttonConfiguration key="configuration" style="plain" title="Answer Prompt">
54-
<directionalEdgeInsets key="contentInsets" top="16" leading="0.0" bottom="16" trailing="0.0"/>
55-
</buttonConfiguration>
53+
<buttonConfiguration key="configuration" style="plain" title="Answer Prompt"/>
5654
<connections>
5755
<action selector="answerPromptTapped:" destination="iN0-l3-epB" eventType="touchUpInside" id="maK-JO-Huc"/>
5856
</connections>
5957
</button>
6058
<stackView opaque="NO" contentMode="scaleToFill" spacing="16" translatesAutoresizingMaskIntoConstraints="NO" id="74j-gh-nmq">
61-
<rect key="frame" x="100.5" y="71.5" width="148" height="20.5"/>
59+
<rect key="frame" x="88.5" y="71.5" width="172" height="20.5"/>
6260
<subviews>
63-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="✓ Answered" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ttu-81-Rjc">
61+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="✓ Answered" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ttu-81-Rjc">
6462
<rect key="frame" x="0.0" y="0.0" width="94.5" height="20.5"/>
6563
<fontDescription key="fontDescription" type="system" pointSize="17"/>
6664
<nil key="textColor"/>
6765
<nil key="highlightedColor"/>
6866
</label>
6967
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="deu-kl-qJY">
70-
<rect key="frame" x="110.5" y="0.0" width="37.5" height="20.5"/>
68+
<rect key="frame" x="110.5" y="0.0" width="61.5" height="20.5"/>
7169
<state key="normal" title="Button"/>
72-
<buttonConfiguration key="configuration" style="plain" title="Share">
73-
<directionalEdgeInsets key="contentInsets" top="16" leading="0.0" bottom="16" trailing="0.0"/>
74-
</buttonConfiguration>
70+
<buttonConfiguration key="configuration" style="plain" title="Share"/>
7571
<connections>
7672
<action selector="shareTapped:" destination="iN0-l3-epB" eventType="touchUpInside" id="ABZ-P1-FDh"/>
7773
</connections>

0 commit comments

Comments
 (0)