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

pull/246/head
Ryan ZHAO 5 years ago
parent 9ca4c83b70
commit a6b63c827e

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

Loading…
Cancel
Save