@ -371,7 +371,7 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
previousPhotoCollection : photoCollection ,
collectionDelegate : self )
guard let collection View = collectionPickerController . view else {
guard let collection Picker View = collectionPickerController . view else {
owsFailDebug ( " collectionView was unexpectedly nil " )
return
}
@ -381,8 +381,14 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
addChildViewController ( collectionPickerController )
view . addSubview ( collectionView )
collectionView . autoPinEdgesToSuperviewEdges ( )
view . addSubview ( collectionPickerView )
collectionPickerView . autoPinEdgesToSuperviewEdges ( )
collectionPickerView . layoutIfNeeded ( )
collectionPickerView . frame = view . frame . offsetBy ( dx : 0 , dy : view . frame . height )
UIView . animate ( . promise , duration : 0.3 , delay : 0 , options : . curveEaseInOut ) {
collectionPickerView . superview ? . layoutIfNeeded ( )
} . retainUntilComplete ( )
}
func hideCollectionPicker ( ) {
@ -392,13 +398,13 @@ class ImagePickerGridController: UICollectionViewController, PhotoLibraryDelegat
return
}
self . collectionPickerController = nil
// T O D O a n i m a t e / h i d e
// M J K r e a l l y ? T h i s d o c u m e n t a t i o n i s s u r p r i s i n g . . .
// I f y o u a r e i m p l e m e n t i n g y o u r o w n c o n t a i n e r v i e w c o n t r o l l e r , i t m u s t c a l l t h e w i l l M o v e ( t o P a r e n t : ) m e t h o d o f t h e c h i l d v i e w c o n t r o l l e r b e f o r e c a l l i n g t h e r e m o v e F r o m P a r e n t ( ) m e t h o d , p a s s i n g i n a p a r e n t v a l u e o f n i l .
collectionPickerController . view . removeFromSuperview ( )
collectionPickerController . removeFromParentViewController ( )
UIView . animate ( . promise , duration : 0.3 , delay : 0 , options : . curveEaseInOut ) {
collectionPickerController . view . frame = self . view . frame . offsetBy ( dx : 0 , dy : self . view . frame . height )
} . done { _ in
collectionPickerController . view . removeFromSuperview ( )
collectionPickerController . removeFromParentViewController ( )
} . retainUntilComplete ( )
}
// MARK: - P h o t o C o l l e c t i o n P i c k e r D e l e g a t e