diff --git a/MVMCoreUI/LegacyControllers/TopLabelsAndBottomButtonsTableViewController.m b/MVMCoreUI/LegacyControllers/TopLabelsAndBottomButtonsTableViewController.m index 3082e0ac..fe83351b 100644 --- a/MVMCoreUI/LegacyControllers/TopLabelsAndBottomButtonsTableViewController.m +++ b/MVMCoreUI/LegacyControllers/TopLabelsAndBottomButtonsTableViewController.m @@ -31,6 +31,7 @@ @property (strong, nonatomic) UIView *footerViewOutsideOfScroll; @property (strong, nonatomic) NSLayoutConstraint *bottomViewTopConstraint; @property (strong, nonatomic) UIView *headerAccessoryView; +@property (strong, nonatomic) UIView *topAccessoryView; @end @@ -76,18 +77,12 @@ - (nullable UIView *)setUpTopAccessoryView { NSArray *accessoryViews = [self topAccessoryViews]; - if (accessoryViews.count > 0) { - UIView *headerAccessoryView = [[UIView alloc] initWithFrame:CGRectZero]; - headerAccessoryView.translatesAutoresizingMaskIntoConstraints = NO; - - __block typeof(self) weakSelf = self; - [StackableViewController populateView:headerAccessoryView withUIArray:accessoryViews withSpacingBlock:^UIEdgeInsets(id _Nullable object) { - UIEdgeInsets edgeInsets = [weakSelf spaceAroundUIObject:object]; - edgeInsets.left = 0; - edgeInsets.right = 0; - return edgeInsets; + if (accessoryViews.count) { + UIView *topAccessoryView = [MVMCoreUICommonViewsUtility commonView]; + [StackableViewController populateView:topAccessoryView withUIArray:accessoryViews withSpacingBlock:^UIEdgeInsets(id _Nullable object) { + return UIEdgeInsetsZero; }]; - return headerAccessoryView; + return topAccessoryView; } return nil; } @@ -276,6 +271,7 @@ [header addSubview:headerAccessoryView]; UIView *topAccessoryView = [self setUpTopAccessoryView]; + self.topAccessoryView = topAccessoryView; if (topAccessoryView) { [header addSubview:topAccessoryView]; [NSLayoutConstraint constraintPinSubview:topAccessoryView pinTop:YES pinBottom:NO pinLeft:YES pinRight:YES]; @@ -490,6 +486,10 @@ #pragma mark - Animation -(void)setupIntroAnimations { + + if (self.topAccessoryView.subviews.count) { + [self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.topAccessoryView]]; + } if (self.topView.subviews.count) { [self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.topView]]; } diff --git a/MVMCoreUI/LegacyControllers/TopLabelsAndBottomButtonsViewController.m b/MVMCoreUI/LegacyControllers/TopLabelsAndBottomButtonsViewController.m index 06ad0028..d7c1ca41 100644 --- a/MVMCoreUI/LegacyControllers/TopLabelsAndBottomButtonsViewController.m +++ b/MVMCoreUI/LegacyControllers/TopLabelsAndBottomButtonsViewController.m @@ -31,6 +31,8 @@ @property (nullable, weak, nonatomic) UIView *betweenView; +@property (strong, nonatomic) UIView *topAccessoryView; + // Adds the button view to the screen. Out of the scroll or in. - (void)addViewOutsideOfScrollView:(UIView *)bottomView; - (void)addViewToContentView:(UIView *)bottomView; @@ -117,6 +119,7 @@ [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[topView]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topView)]]; UIView *topAccessoryView = [self setUpTopAccessoryView]; + self.topAccessoryView = topAccessoryView; if (topAccessoryView) { [self.contentView addSubview:topAccessoryView]; [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[topAccessoryView]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topAccessoryView)]]; @@ -283,18 +286,17 @@ - (nullable UIView *)setUpTopAccessoryView { NSArray *accessoryViews = [self topAccessoryViews]; - if (accessoryViews.count > 0) { - UIView *headerAccessoryView = [[UIView alloc] initWithFrame:CGRectZero]; - headerAccessoryView.translatesAutoresizingMaskIntoConstraints = NO; + if (accessoryViews.count) { + UIView *topAccessoryView = [MVMCoreUICommonViewsUtility commonView]; __block typeof(self) weakSelf = self; - [StackableViewController populateView:headerAccessoryView withUIArray:accessoryViews withSpacingBlock:^UIEdgeInsets(id _Nullable object) { + [StackableViewController populateView:topAccessoryView withUIArray:accessoryViews withSpacingBlock:^UIEdgeInsets(id _Nullable object) { UIEdgeInsets edgeInsets = [weakSelf spaceAroundUIObject:object]; edgeInsets.left = 0; edgeInsets.right = 0; return edgeInsets; }]; - return headerAccessoryView; + return topAccessoryView; } return nil; } @@ -439,6 +441,11 @@ #pragma mark - Animations -(void)setupIntroAnimations { + + if (self.topAccessoryView.subviews.count) { + [self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.topAccessoryView]]; + } + if (self.topView.subviews) { [self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.topView]]; }