diff --git a/NextGrowingTextView-Demo/Book.swift b/NextGrowingTextView-Demo/Book.swift index e05d31d..65b823a 100644 --- a/NextGrowingTextView-Demo/Book.swift +++ b/NextGrowingTextView-Demo/Book.swift @@ -51,6 +51,11 @@ func makeControlPanel(for growingTextView: NextGrowingTextView) -> UIView { UIButton.make(title: "Min = 5") { growingTextView.configuration.minLines = 5 } + + UIButton.make(title: "Long placeholder") { + growingTextView.placeholderLabel.text = "Placeholder, Placeholder, Placeholder, " + growingTextView.placeholderLabel.numberOfLines = 0 + } } } diff --git a/NextGrowingTextView/NextGrowingTextView.swift b/NextGrowingTextView/NextGrowingTextView.swift index 89aacc8..2225225 100644 --- a/NextGrowingTextView/NextGrowingTextView.swift +++ b/NextGrowingTextView/NextGrowingTextView.swift @@ -185,6 +185,8 @@ open class NextGrowingTextView: UIView { case .center: NSLayoutConstraint.activate([ placeholderLabel.centerXAnchor.constraint(equalTo: centerXAnchor, constant: 0), + placeholderLabel.leadingAnchor.constraint(greaterThanOrEqualTo: leadingAnchor, constant: inset.left + 4), + placeholderLabel.trailingAnchor.constraint(lessThanOrEqualTo: trailingAnchor, constant: -(inset.right + 4)), ]) case .trailing: NSLayoutConstraint.activate([