fix aaptions with just 1 character aren’t displayed when opening the image

This commit is contained in:
Ryan ZHAO 2020-08-10 15:49:51 +10:00
parent 9ca4c83b70
commit a6b63c827e
1 changed files with 4 additions and 2 deletions

View File

@ -27,13 +27,13 @@ public class CaptionContainerView: UIView {
}
func updatePagerTransition(ratioComplete: CGFloat) {
if let currentText = self.currentText, currentText.count > 1 {
if let currentText = self.currentText, currentText.count > 0 {
currentCaptionView.alpha = 1 - ratioComplete
} else {
currentCaptionView.alpha = 0
}
if let pendingText = self.pendingText, pendingText.count > 1 {
if let pendingText = self.pendingText, pendingText.count > 0 {
pendingCaptionView.alpha = ratioComplete
} else {
pendingCaptionView.alpha = 0
@ -48,6 +48,8 @@ public class CaptionContainerView: UIView {
self.currentCaptionView = self.pendingCaptionView
self.pendingCaptionView = oldCaptionView
self.pendingText = nil
self.currentCaptionView.alpha = 1
self.pendingCaptionView.alpha = 0
}
// MARK: Initializers