code cleanup

This commit is contained in:
Murugan, Vimal 2019-11-15 21:10:37 +05:30
parent 627114ded8
commit 76cd37d121
2 changed files with 23 additions and 16 deletions

View File

@ -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];
@ -499,6 +495,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]];
}

View File

@ -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]];
}