From 6d081c2bbb9f06942d8ebf52667a4e34a11fd233 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Fri, 9 Sep 2022 16:03:24 -0500 Subject: [PATCH] Fixes CollapsingTextView incorrectly showing More button --- AltStore/Components/CollapsingTextView.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/AltStore/Components/CollapsingTextView.swift b/AltStore/Components/CollapsingTextView.swift index 8deb38cb..656a8fcb 100644 --- a/AltStore/Components/CollapsingTextView.swift +++ b/AltStore/Components/CollapsingTextView.swift @@ -71,8 +71,10 @@ class CollapsingTextView: UITextView { self.textContainer.maximumNumberOfLines = self.maximumNumberOfLines - let maximumCollapsedHeight = font.lineHeight * CGFloat(self.maximumNumberOfLines) - if self.intrinsicContentSize.height > maximumCollapsedHeight + let boundingSize = self.attributedText.boundingRect(with: CGSize(width: self.textContainer.size.width, height: .infinity), options: [.usesLineFragmentOrigin, .usesFontLeading], context: nil) + let maximumCollapsedHeight = font.lineHeight * Double(self.maximumNumberOfLines) + + if boundingSize.height.rounded() > maximumCollapsedHeight.rounded() { var exclusionFrame = moreButtonFrame exclusionFrame.origin.y += self.moreButton.bounds.midY