Merge branch 'feature/top_accessory' of gitlab.verizon.com:BPHV_MIPS/mvm_core_ui into feature/top_accessory

This commit is contained in:
Suresh, Kamlesh 2019-11-15 11:42:34 -05:00
commit cd5f66875d
2 changed files with 23 additions and 16 deletions

View File

@ -31,6 +31,7 @@
@property (strong, nonatomic) UIView *footerViewOutsideOfScroll; @property (strong, nonatomic) UIView *footerViewOutsideOfScroll;
@property (strong, nonatomic) NSLayoutConstraint *bottomViewTopConstraint; @property (strong, nonatomic) NSLayoutConstraint *bottomViewTopConstraint;
@property (strong, nonatomic) UIView *headerAccessoryView; @property (strong, nonatomic) UIView *headerAccessoryView;
@property (strong, nonatomic) UIView *topAccessoryView;
@end @end
@ -76,18 +77,12 @@
- (nullable UIView *)setUpTopAccessoryView { - (nullable UIView *)setUpTopAccessoryView {
NSArray *accessoryViews = [self topAccessoryViews]; NSArray *accessoryViews = [self topAccessoryViews];
if (accessoryViews.count > 0) { if (accessoryViews.count) {
UIView *headerAccessoryView = [[UIView alloc] initWithFrame:CGRectZero]; UIView *topAccessoryView = [MVMCoreUICommonViewsUtility commonView];
headerAccessoryView.translatesAutoresizingMaskIntoConstraints = NO; [StackableViewController populateView:topAccessoryView withUIArray:accessoryViews withSpacingBlock:^UIEdgeInsets(id _Nullable object) {
return UIEdgeInsetsZero;
__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;
}]; }];
return headerAccessoryView; return topAccessoryView;
} }
return nil; return nil;
} }
@ -276,6 +271,7 @@
[header addSubview:headerAccessoryView]; [header addSubview:headerAccessoryView];
UIView *topAccessoryView = [self setUpTopAccessoryView]; UIView *topAccessoryView = [self setUpTopAccessoryView];
self.topAccessoryView = topAccessoryView;
if (topAccessoryView) { if (topAccessoryView) {
[header addSubview:topAccessoryView]; [header addSubview:topAccessoryView];
[NSLayoutConstraint constraintPinSubview:topAccessoryView pinTop:YES pinBottom:NO pinLeft:YES pinRight:YES]; [NSLayoutConstraint constraintPinSubview:topAccessoryView pinTop:YES pinBottom:NO pinLeft:YES pinRight:YES];
@ -490,6 +486,10 @@
#pragma mark - Animation #pragma mark - Animation
-(void)setupIntroAnimations { -(void)setupIntroAnimations {
if (self.topAccessoryView.subviews.count) {
[self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.topAccessoryView]];
}
if (self.topView.subviews.count) { if (self.topView.subviews.count) {
[self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.topView]]; [self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.topView]];
} }

View File

@ -31,6 +31,8 @@
@property (nullable, weak, nonatomic) UIView *betweenView; @property (nullable, weak, nonatomic) UIView *betweenView;
@property (strong, nonatomic) UIView *topAccessoryView;
// Adds the button view to the screen. Out of the scroll or in. // Adds the button view to the screen. Out of the scroll or in.
- (void)addViewOutsideOfScrollView:(UIView *)bottomView; - (void)addViewOutsideOfScrollView:(UIView *)bottomView;
- (void)addViewToContentView:(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)]]; [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[topView]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topView)]];
UIView *topAccessoryView = [self setUpTopAccessoryView]; UIView *topAccessoryView = [self setUpTopAccessoryView];
self.topAccessoryView = topAccessoryView;
if (topAccessoryView) { if (topAccessoryView) {
[self.contentView addSubview:topAccessoryView]; [self.contentView addSubview:topAccessoryView];
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[topAccessoryView]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topAccessoryView)]]; [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[topAccessoryView]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(topAccessoryView)]];
@ -283,18 +286,17 @@
- (nullable UIView *)setUpTopAccessoryView { - (nullable UIView *)setUpTopAccessoryView {
NSArray *accessoryViews = [self topAccessoryViews]; NSArray *accessoryViews = [self topAccessoryViews];
if (accessoryViews.count > 0) { if (accessoryViews.count) {
UIView *headerAccessoryView = [[UIView alloc] initWithFrame:CGRectZero]; UIView *topAccessoryView = [MVMCoreUICommonViewsUtility commonView];
headerAccessoryView.translatesAutoresizingMaskIntoConstraints = NO;
__block typeof(self) weakSelf = self; __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]; UIEdgeInsets edgeInsets = [weakSelf spaceAroundUIObject:object];
edgeInsets.left = 0; edgeInsets.left = 0;
edgeInsets.right = 0; edgeInsets.right = 0;
return edgeInsets; return edgeInsets;
}]; }];
return headerAccessoryView; return topAccessoryView;
} }
return nil; return nil;
} }
@ -439,6 +441,11 @@
#pragma mark - Animations #pragma mark - Animations
-(void)setupIntroAnimations { -(void)setupIntroAnimations {
if (self.topAccessoryView.subviews.count) {
[self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.topAccessoryView]];
}
if (self.topView.subviews) { if (self.topView.subviews) {
[self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.topView]]; [self.introAnimationManager addAnimationWithAnimation:[MVMAnimations fadeUpAnimationWithView:self.topView]];
} }