Hide "Select" button while album chooser presented

TODO:

-[x] establish parent/child relation
-[x] reconcile changes with collection picker delegate
-[x] present/dismiss animation
-[x] animate title label
-[x] hide (some?) bar button items when collection picker presented

Nice to have:

-[] crop child view top - so that it comes *up to* the navbar bottom, but
    doesn't go behind
pull/1/head
Michael Kirk 7 years ago
parent 5490f07bb9
commit 635401dc5e

@ -317,6 +317,11 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
}
func updateSelectButton() {
guard !isShowingCollectionPickerController else {
navigationItem.rightBarButtonItem = nil
return
}
let button = isInBatchSelectMode ? doneButton : selectButton
button.tintColor = .ows_gray05
navigationItem.rightBarButtonItem = button
@ -389,6 +394,8 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
UIView.animate(.promise, duration: 0.3, delay: 0, options: .curveEaseInOut) {
collectionPickerView.superview?.layoutIfNeeded()
self.updateSelectButton()
// *slightly* more than `pi` to ensure the chevron animates anti-clockwise
let chevronRotationAngle = CGFloat.pi.nextUp
self.titleIconView.transform = CGAffineTransform(rotationAngle: chevronRotationAngle)
@ -405,6 +412,9 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
UIView.animate(.promise, duration: 0.3, delay: 0, options: .curveEaseInOut) {
collectionPickerController.view.frame = self.view.frame.offsetBy(dx: 0, dy: self.view.frame.height)
self.updateSelectButton()
self.titleIconView.transform = .identity
}.done { _ in
collectionPickerController.view.removeFromSuperview()

Loading…
Cancel
Save