@@ -104,8 +104,8 @@ - (void)viewDidLoad
104104 [self addCollectionViewToView ];
105105 [self setupCollectionView ];
106106 [self setupSearchBar ];
107-
108107 [self setupLayout ];
108+ [self addEmptyViewContainer ];
109109
110110 // setup data
111111 [self .dataSource setMediaTypeFilter: self .options.filter];
@@ -590,14 +590,8 @@ - (void)showCapture {
590590
591591/* * An empty view container to hold the emptyViewController or emptyView that comes from the delegate
592592 */
593- - (void )addContainerEmptyView
593+ - (void )addEmptyViewContainer
594594{
595- if (self.emptyViewContainer != nil && self.emptyViewContainer .superview != nil ) {
596- self.emptyViewContainer .hidden = false ;
597- [self addEmptyViewToContainer ];
598- return ;
599- }
600-
601595 self.emptyViewContainer = [[UIView alloc ] initWithFrame: self .collectionView.frame];
602596 [self .emptyViewContainer setTranslatesAutoresizingMaskIntoConstraints: NO ];
603597 [self .collectionView addSubview: self .emptyViewContainer];
@@ -613,8 +607,6 @@ - (void)addContainerEmptyView
613607 [self .emptyViewContainer.trailingAnchor constraintEqualToAnchor: self .view.trailingAnchor]
614608 ]
615609 ];
616-
617- [self addEmptyViewToContainer ];
618610}
619611
620612- (UIView *)emptyView
@@ -634,12 +626,12 @@ - (UIView *)emptyView
634626
635627/* * Checks if the parentViewController is providing a custom empty ViewController to be added, if not, add a provided custom emptyView
636628 */
637- - (void )addEmptyViewToContainer
629+ - (void )populateEmptyViewContainer
638630{
639631 if ([self usingEmptyViewController ]) {
640- [self addEmptyViewControllerToView ];
632+ [self addEmptyViewControllerToContainer ];
641633 } else {
642- [self addEmptyViewToView ];
634+ [self addEmptyViewToContainer ];
643635 }
644636}
645637
@@ -654,7 +646,7 @@ - (UILabel *)defaultEmptyView
654646 return _defaultEmptyView;
655647}
656648
657- - (void )addEmptyViewToView
649+ - (void )addEmptyViewToContainer
658650{
659651 if (self.emptyView != nil && self.emptyView .superview != nil ) {
660652 return ;
@@ -673,7 +665,7 @@ - (void)addEmptyViewToView
673665
674666#pragma mark - Empty View Controller support
675667
676- - (void )addEmptyViewControllerToView
668+ - (void )addEmptyViewControllerToContainer
677669{
678670 if (self.emptyViewController != nil && self.emptyViewController .view .superview != nil ) {
679671 return ;
@@ -923,13 +915,13 @@ - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSe
923915- (void )toggleEmptyViewFor : (NSInteger )numberOfAssets
924916{
925917 if (numberOfAssets > 0 ) {
926- self.emptyViewContainer . hidden = true ;
918+ [ self .emptyViewContainer setHidden: YES ] ;
927919 } else {
928- [self addContainerEmptyView ];
920+ [self .emptyViewContainer setHidden: NO ];
921+ [self populateEmptyViewContainer ];
929922 }
930923}
931924
932-
933925- (id <WPMediaAsset>)assetForPosition : (NSIndexPath *)indexPath
934926{
935927 NSInteger itemPosition = indexPath.item ;
0 commit comments