From a86ca49c5f9e7a567e36100dc5857ee7407d9d82 Mon Sep 17 00:00:00 2001 From: Leandro Alonso Date: Mon, 27 Jan 2020 21:14:45 -0300 Subject: [PATCH 1/2] Fix constraint issues --- Sources/MediaEditorHub.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Sources/MediaEditorHub.swift b/Sources/MediaEditorHub.swift index 74a6562..33057a1 100644 --- a/Sources/MediaEditorHub.swift +++ b/Sources/MediaEditorHub.swift @@ -203,7 +203,7 @@ class MediaEditorHub: UIViewController { } private func setupToolbar() { - toolbarHeight.constant = isSingleImage ? Constants.doneButtonHeight : Constants.thumbHeight + toolbarHeight.constant = isSingleImage ? Constants.toolbarHeight : Constants.thumbHeight thumbsCollectionView.isHidden = isSingleImage ? true : false } @@ -260,7 +260,7 @@ class MediaEditorHub: UIViewController { static var imageCellIdentifier = "imageCell" static var capabCellIdentifier = "capabilityCell" static var thumbHeight: CGFloat = 64 - static var doneButtonHeight: CGFloat = 44 + static var toolbarHeight: CGFloat = 44 } } @@ -324,9 +324,11 @@ extension MediaEditorHub: UICollectionViewDelegateFlowLayout { func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { if collectionView == imagesCollectionView { return CGSize(width: imagesCollectionView.frame.width, height: imagesCollectionView.frame.height) + } else if collectionView == thumbsCollectionView { + return CGSize(width: Constants.thumbHeight, height: Constants.thumbHeight) + } else { + return CGSize(width: Constants.toolbarHeight, height: Constants.toolbarHeight) } - - return CGSize(width: 44, height: 44) } } From bfe349125e56f493956b16bcb57a7c212f9aff82 Mon Sep 17 00:00:00 2001 From: Leandro Alonso Date: Mon, 27 Jan 2020 21:22:23 -0300 Subject: [PATCH 2/2] Fix UICollectionViewFlowLayout warnings --- Sources/MediaEditorHub.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/MediaEditorHub.swift b/Sources/MediaEditorHub.swift index 33057a1..8f8f476 100644 --- a/Sources/MediaEditorHub.swift +++ b/Sources/MediaEditorHub.swift @@ -198,6 +198,7 @@ class MediaEditorHub: UIViewController { thumbsCollectionView.reloadData() imagesCollectionView.reloadData() thumbsCollectionView.layoutIfNeeded() + imagesCollectionView.layoutIfNeeded() thumbsCollectionView.selectItem(at: IndexPath(row: selectedThumbIndex, section: 0), animated: false, scrollPosition: .right) imagesCollectionView.scrollToItem(at: IndexPath(row: selectedThumbIndex, section: 0), at: .right, animated: false) }