mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-26 02:01:00 +00:00
Caption max height
This commit is contained in:
parent
e2d0b37f3f
commit
045524f6a5
1 changed files with 10 additions and 0 deletions
|
@ -111,6 +111,7 @@ final class ImageViewController: UIViewController {
|
||||||
descriptionBackgroundView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
descriptionBackgroundView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||||
descriptionBackgroundView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
descriptionBackgroundView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
||||||
descriptionBackgroundView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
descriptionBackgroundView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
||||||
|
descriptionTextView.heightAnchor.constraint(lessThanOrEqualTo: view.heightAnchor, multiplier: 1 / 4),
|
||||||
descriptionTextView.leadingAnchor.constraint(
|
descriptionTextView.leadingAnchor.constraint(
|
||||||
equalTo: descriptionBackgroundView.layoutMarginsGuide.leadingAnchor),
|
equalTo: descriptionBackgroundView.layoutMarginsGuide.leadingAnchor),
|
||||||
descriptionTextView.topAnchor.constraint(equalTo: descriptionBackgroundView.topAnchor),
|
descriptionTextView.topAnchor.constraint(equalTo: descriptionBackgroundView.topAnchor),
|
||||||
|
@ -172,6 +173,15 @@ final class ImageViewController: UIViewController {
|
||||||
?? Attachment.AttachmentType.image.accessibilityName
|
?? Attachment.AttachmentType.image.accessibilityName
|
||||||
contentView.isAccessibilityElement = true
|
contentView.isAccessibilityElement = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func viewDidLayoutSubviews() {
|
||||||
|
super.viewDidLayoutSubviews()
|
||||||
|
|
||||||
|
let textHeight = descriptionTextView.sizeThatFits(.init(
|
||||||
|
width: descriptionTextView.frame.width,
|
||||||
|
height: .greatestFiniteMagnitude)).height
|
||||||
|
descriptionTextView.isScrollEnabled = textHeight > descriptionTextView.frame.height
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ImageViewController {
|
extension ImageViewController {
|
||||||
|
|
Loading…
Reference in a new issue