Skip to content

Commit 858c924

Browse files
authored
Fix multiline placeholder #102
1 parent 83a3ec5 commit 858c924

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

NextGrowingTextView-Demo/Book.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ func makeControlPanel(for growingTextView: NextGrowingTextView) -> UIView {
5151
UIButton.make(title: "Min = 5") {
5252
growingTextView.configuration.minLines = 5
5353
}
54+
55+
UIButton.make(title: "Long placeholder") {
56+
growingTextView.placeholderLabel.text = "Placeholder, Placeholder, Placeholder, "
57+
growingTextView.placeholderLabel.numberOfLines = 0
58+
}
5459
}
5560

5661
}

NextGrowingTextView/NextGrowingTextView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ open class NextGrowingTextView: UIView {
185185
case .center:
186186
NSLayoutConstraint.activate([
187187
placeholderLabel.centerXAnchor.constraint(equalTo: centerXAnchor, constant: 0),
188+
placeholderLabel.leadingAnchor.constraint(greaterThanOrEqualTo: leadingAnchor, constant: inset.left + 4),
189+
placeholderLabel.trailingAnchor.constraint(lessThanOrEqualTo: trailingAnchor, constant: -(inset.right + 4)),
188190
])
189191
case .trailing:
190192
NSLayoutConstraint.activate([

0 commit comments

Comments
 (0)