Skip to content

Commit

Permalink
Fix images label alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
vadymmarkov committed Nov 12, 2015
1 parent e6c1844 commit 53c1bfa
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Source/ImageGallery/ImageGalleryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,12 @@ public class ImageGalleryView: UIView {
func updateNoImagesLabel() {
let height = CGRectGetHeight(bounds)
let threshold = Dimensions.galleryBarHeight * 2

noImagesLabel.center = CGPoint(x: CGRectGetWidth(bounds)/2, y: height/2)
noImagesLabel.alpha = (height > threshold) ? 1 : (height - Dimensions.galleryBarHeight) / threshold
if threshold > height || collectionView.alpha != 0 {
noImagesLabel.alpha = 0
} else {
noImagesLabel.center = CGPoint(x: CGRectGetWidth(bounds)/2, y: height/2)
noImagesLabel.alpha = (height > threshold) ? 1 : (height - Dimensions.galleryBarHeight) / threshold
}
}

// MARK: - Photos handler
Expand Down Expand Up @@ -183,7 +186,7 @@ public class ImageGalleryView: UIView {

func displayNoImagesMessage(hideCollectionView: Bool) {
collectionView.alpha = hideCollectionView ? 0 : 1
noImagesLabel.alpha = hideCollectionView ? 1 : 0
updateNoImagesLabel()
}

func checkStatus() {
Expand Down

0 comments on commit 53c1bfa

Please sign in to comment.