Skip to content

Commit

Permalink
Fix multiline placeholder #102
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii authored Apr 18, 2022
1 parent 83a3ec5 commit 858c924
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions NextGrowingTextView-Demo/Book.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

}
Expand Down
2 changes: 2 additions & 0 deletions NextGrowingTextView/NextGrowingTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down

0 comments on commit 858c924

Please sign in to comment.