From 2c3214e55bf229538cafadc131ac83f05711c0c6 Mon Sep 17 00:00:00 2001 From: Anton Vodolazkyi Date: Tue, 18 Apr 2017 14:22:05 +0300 Subject: [PATCH 1/2] Fix memory issue --- .../Constants/YALAnimatingTabBarConstants.h | 10 +- .../Constants/YALAnimatingTabBarConstants.m | 8 +- .../View/FoldingTabBar/YALFoldingTabBar.m | 241 +++++++++--------- 3 files changed, 142 insertions(+), 117 deletions(-) diff --git a/FoldingTabBar/Constants/YALAnimatingTabBarConstants.h b/FoldingTabBar/Constants/YALAnimatingTabBarConstants.h index f6c1391..f1ba55e 100644 --- a/FoldingTabBar/Constants/YALAnimatingTabBarConstants.h +++ b/FoldingTabBar/Constants/YALAnimatingTabBarConstants.h @@ -9,7 +9,13 @@ extern CGFloat const YALExtraTabBarItemsDefaultHeight; extern CGFloat const YALForExtraTabBarItemsDefaultOffset; extern UIEdgeInsets const YALTabBarViewHDefaultEdgeInsets; extern UIEdgeInsets const YALTabBarViewItemsDefaultEdgeInsets; - +extern NSString * const YALCenterButtonExpandAnimation; +extern NSString * const YALCenterButtonCollapseAnimation; +extern NSString * const YALAdditionalButtonsAnimation; +extern NSString * const YALTabBarExpandAnimation; +extern NSString * const YALTabBarExpandCollapseAnimation; +extern NSString * const YALExtraLeftBarItemAnimation; +extern NSString * const YALExtraRightBarItemAnimation; extern CFTimeInterval const kYALExpandAnimationDuration; @@ -57,4 +63,4 @@ extern YALCenterButtonAnimationsParameters const kYALCenterButtonExpandAnimation extern YALCenterButtonAnimationsParameters const kYALCenterButtonCollapseAnimationParameters; extern YALAnimationParameters const kYALBounceAnimationParameters; extern YALExtraTabBarItemViewAnimationParameters const kYALShowExtraTabBarItemViewAnimationParameters; -extern YALExtraTabBarItemViewAnimationParameters const kYALHideExtraTabBarItemViewAnimationParameters; \ No newline at end of file +extern YALExtraTabBarItemViewAnimationParameters const kYALHideExtraTabBarItemViewAnimationParameters; diff --git a/FoldingTabBar/Constants/YALAnimatingTabBarConstants.m b/FoldingTabBar/Constants/YALAnimatingTabBarConstants.m index f61c2b7..b020eaa 100644 --- a/FoldingTabBar/Constants/YALAnimatingTabBarConstants.m +++ b/FoldingTabBar/Constants/YALAnimatingTabBarConstants.m @@ -9,7 +9,13 @@ CGFloat const YALForExtraTabBarItemsDefaultOffset = 15.f; UIEdgeInsets const YALTabBarViewHDefaultEdgeInsets = {10.f, 14.f, 10.f, 14.f}; UIEdgeInsets const YALTabBarViewItemsDefaultEdgeInsets = {0.f, 0.f, 0.f, 0.f}; - +NSString * const YALCenterButtonExpandAnimation = @"CENTER_BUTOON_EXPAND_ANIMATION"; +NSString * const YALCenterButtonCollapseAnimation = @"CENTER_BUTOON_COLLAPSE_ANIMATION"; +NSString * const YALAdditionalButtonsAnimation = @"ADDITIONAL_BUTTONS_ANIMATION"; +NSString * const YALTabBarExpandAnimation = @"TABBAR_EXPAND_ANIMATION"; +NSString * const YALTabBarExpandCollapseAnimation = @"TABBAR_COLLAPSE_ANIMATION"; +NSString * const YALExtraLeftBarItemAnimation = @"EXTRA_LEFT_BAR_ITEM_ANIMATION"; +NSString * const YALExtraRightBarItemAnimation = @"EXTRA_RIGHT_BAR_ITEM_ANIMATION"; CFTimeInterval const kYALExpandAnimationDuration = 1.0; diff --git a/FoldingTabBar/View/FoldingTabBar/YALFoldingTabBar.m b/FoldingTabBar/View/FoldingTabBar/YALFoldingTabBar.m index b9c2d60..e495032 100644 --- a/FoldingTabBar/View/FoldingTabBar/YALFoldingTabBar.m +++ b/FoldingTabBar/View/FoldingTabBar/YALFoldingTabBar.m @@ -16,48 +16,48 @@ typedef NS_ENUM(NSUInteger, YALAnimatingState) { #import "YALAnimatingTabBarConstants.h" @interface YALFoldingTabBar () - -@property (nonatomic, strong) NSArray *allBarItems; - -@property (nonatomic, assign) YALAnimatingState animatingState; -@property (nonatomic, assign) BOOL isFinishedCenterButtonAnimation; - -@property (nonatomic, strong) UIButton *centerButton; -@property (nonatomic, strong) UIView *mainView; - -@property (nonatomic, assign, getter = isAnimating) BOOL animating; - -@property (nonatomic, assign) CGRect collapsedFrame; -@property (nonatomic, assign) CGRect expandedFrame; - -@property (nonatomic, assign) CGRect collapsedBounds; -@property (nonatomic, assign) CGRect expandedBounds; - -@property (nonatomic, assign) NSUInteger counter; - -//buttons used instead of native tabBarItems to switch between controllers -@property (nonatomic, strong) NSArray *leftButtonsArray; -@property (nonatomic, strong) NSArray *rightButtonsArray; - -//extra buttons 'tabBarItems' for each 'tabBarItem' -@property (nonatomic, strong) UIButton *extraLeftButton; -@property (nonatomic, strong) UIButton *extraRightButton; - -//model representation of tabBarItems. also contains info for extraBarItems: image, color, etc -@property (nonatomic, strong) NSDictionary *leftTabBarItems; -@property (nonatomic, strong) NSDictionary *rightTabBarItems; - -//array of all buttons just for simple switching between controllers by index -@property (nonatomic, strong) NSArray *allAdditionalButtons; -@property (nonatomic, strong) NSMutableArray *allAdditionalButtonsBottomView; - -@end + + @property (nonatomic, strong) NSArray *allBarItems; + + @property (nonatomic, assign) YALAnimatingState animatingState; + @property (nonatomic, assign) BOOL isFinishedCenterButtonAnimation; + + @property (nonatomic, strong) UIButton *centerButton; + @property (nonatomic, strong) UIView *mainView; + + @property (nonatomic, assign, getter = isAnimating) BOOL animating; + + @property (nonatomic, assign) CGRect collapsedFrame; + @property (nonatomic, assign) CGRect expandedFrame; + + @property (nonatomic, assign) CGRect collapsedBounds; + @property (nonatomic, assign) CGRect expandedBounds; + + @property (nonatomic, assign) NSUInteger counter; + + //buttons used instead of native tabBarItems to switch between controllers + @property (nonatomic, strong) NSArray *leftButtonsArray; + @property (nonatomic, strong) NSArray *rightButtonsArray; + + //extra buttons 'tabBarItems' for each 'tabBarItem' + @property (nonatomic, strong) UIButton *extraLeftButton; + @property (nonatomic, strong) UIButton *extraRightButton; + + //model representation of tabBarItems. also contains info for extraBarItems: image, color, etc + @property (nonatomic, strong) NSDictionary *leftTabBarItems; + @property (nonatomic, strong) NSDictionary *rightTabBarItems; + + //array of all buttons just for simple switching between controllers by index + @property (nonatomic, strong) NSArray *allAdditionalButtons; + @property (nonatomic, strong) NSMutableArray *allAdditionalButtonsBottomView; + + @end @implementation YALFoldingTabBar - + #pragma mark - Instantiation - - + + - (instancetype)initWithController:(YALFoldingTabBarController *)controller { self = [super initWithFrame:CGRectZero]; @@ -71,13 +71,13 @@ - (instancetype)initWithController:(YALFoldingTabBarController *)controller { return self; } - + - (void)layoutSubviews { [super layoutSubviews]; [self setupUI]; } - + - (void)setState:(YALTabBarState)state { if (_state == state) { return; @@ -96,9 +96,9 @@ - (void)setState:(YALTabBarState)state { _state = state; } - + #pragma mark - Private - + - (void)setupUI { [self removeViewsBeforeUpdateUI]; @@ -109,38 +109,38 @@ - (void)setupUI { self.collapsedFrame = self.centerButton.frame; [self setupAdditionalTabBarItems]; - + [self updateMaskLayer]; - + [self setupExtraTabBarItems]; [self setupTabBarItemsViewRepresentation]; [self setupBarItemsModelRepresentation]; [self prepareTabBarViewForInitialState]; } - + - (void)removeViewsBeforeUpdateUI { - + if (self.mainView) { [self.mainView removeFromSuperview]; self.mainView = nil; } - + if (self.extraLeftButton) { [self.extraLeftButton removeFromSuperview]; self.extraLeftButton = nil; } - + if (self.extraRightButton) { [self.extraRightButton removeFromSuperview]; self.extraRightButton = nil; } - + if (self.centerButton) { [self.centerButton removeFromSuperview]; self.centerButton = nil; } } - + - (void)setupCenterButton { self.centerButton = [[UIButton alloc] initWithFrame:CGRectMake(CGRectGetMidX(self.mainView.frame) - CGRectGetHeight(self.mainView.frame) / 2.0f, CGRectGetMidY(self.mainView.frame) - CGRectGetHeight(self.mainView.frame) / 2.f, @@ -158,10 +158,10 @@ - (void)setupCenterButton { [self addSubview:self.centerButton]; } - + - (void)setupMainView { self.mainView = [[UIView alloc] initWithFrame:UIEdgeInsetsInsetRect(self.bounds, self.tabBarViewEdgeInsets)]; - + self.expandedFrame = self.mainView.frame; self.mainView.layer.cornerRadius = CGRectGetHeight(self.mainView.bounds) / 2.f; self.mainView.layer.masksToBounds = YES; @@ -169,7 +169,7 @@ - (void)setupMainView { [self addSubview:self.mainView]; } - + - (void)setupAdditionalTabBarItems { NSArray *leftTabBarItems = [self.dataSource leftTabBarItemsInTabBarView:self]; NSArray *rightTabBarItems = [self.dataSource rightTabBarItemsInTabBarView:self]; @@ -204,7 +204,7 @@ - (void)setupAdditionalTabBarItems { for (int i = 0; i < numberOfLeftTabBarButtonItems; i++) { CGFloat buttonOriginX = startPositionLeft - maxWidthForLeftBarButonItem * (i+1); CGFloat buttonOriginY = 0.f; - + CGFloat buttonWidth = maxWidthForLeftBarButonItem; CGFloat buttonHeight = CGRectGetHeight(self.mainView.frame); @@ -225,7 +225,7 @@ - (void)setupAdditionalTabBarItems { [button addTarget:self action:@selector(didTapBarItem:) forControlEvents:UIControlEventTouchUpInside]; if (self.state == YALTabBarStateCollapsed) { - button.hidden = YES; + button.hidden = YES; } @@ -241,7 +241,7 @@ - (void)setupAdditionalTabBarItems { [reverseArrayLeft addObject:element]; } mutableDotsArray = reverseArrayLeftDotViews; - + self.leftButtonsArray = [mutableArray copy]; [mutableArray removeAllObjects]; @@ -267,7 +267,7 @@ - (void)setupAdditionalTabBarItems { UIImage *image = item.itemImage; UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(buttonOriginX, buttonOriginY, buttonWidth, buttonHeight)]; - + if (numberOfLeftTabBarButtonItems == 1) { CGRect rect = button.frame; rect.size.width = CGRectGetHeight(self.mainView.frame); @@ -287,8 +287,8 @@ - (void)setupAdditionalTabBarItems { self.rightButtonsArray = [mutableArray copy]; } - -//collect all tabBarItems (models) to one array + + //collect all tabBarItems (models) to one array - (void)setupBarItemsModelRepresentation { NSMutableArray *tempMutableArrayOfBarItems = [NSMutableArray array]; @@ -305,7 +305,7 @@ - (void)setupBarItemsModelRepresentation { self.allBarItems = [tempMutableArrayOfBarItems copy]; } - + - (void)setupExtraTabBarItems { self.extraLeftButton = [[UIButton alloc] initWithFrame:CGRectMake(0.0f, CGRectGetMidY(self.mainView.frame) - CGRectGetHeight(self.mainView.frame) / 2.f, self.extraTabBarItemHeight, self.extraTabBarItemHeight)]; self.extraLeftButton.center = CGPointMake( - CGRectGetWidth(self.extraLeftButton.frame) / 2, self.mainView.center.y); @@ -326,10 +326,10 @@ - (void)setupExtraTabBarItems { self.extraRightButton.backgroundColor = self.tabBarColor; [self.extraRightButton addTarget:self action:@selector(didPressExtraRightButton:) forControlEvents:UIControlEventTouchUpInside]; self.extraRightButton.hidden = YES; - + [self addSubview:self.extraRightButton]; } - + - (void)changeExtraLeftTabBarItemWithImage:(UIImage *)image { if (image) { self.extraLeftButton.hidden = NO; @@ -338,7 +338,7 @@ - (void)changeExtraLeftTabBarItemWithImage:(UIImage *)image { self.extraLeftButton.hidden = YES; } } - + - (void)changeExtraRightTabBarItemWithImage:(UIImage *)image { if (image) { self.extraRightButton.hidden = NO; @@ -347,7 +347,7 @@ - (void)changeExtraRightTabBarItemWithImage:(UIImage *)image { self.extraRightButton.hidden = YES; } } - + - (void)setupTabBarItemsViewRepresentation { NSMutableArray *tempArray = [NSMutableArray array]; NSMutableArray *reverseArray = [NSMutableArray arrayWithCapacity:[self.leftButtonsArray count]]; @@ -368,13 +368,13 @@ - (void)setupTabBarItemsViewRepresentation { dotView.center = CGPointMake(button.center.x, button.center.y + YALBottomSelectedDotOffset); dotView.layer.cornerRadius = CGRectGetHeight(dotView.frame) / 2.f; dotView.backgroundColor = self.dotColor; - + dotView.hidden = YES; [self.mainView addSubview:dotView]; [self.allAdditionalButtonsBottomView addObject:dotView]; } } - + - (void)prepareTabBarViewForInitialState { if (![self hasTabBarItems]) { @@ -397,7 +397,7 @@ - (void)prepareTabBarViewForInitialState { } if (self.state == YALTabBarStateExpanded) { - + UIView *previousSelectedDotView = self.allAdditionalButtonsBottomView [self.selectedTabBarItemIndex]; previousSelectedDotView.hidden = NO; [self.allAdditionalButtonsBottomView replaceObjectAtIndex:self.selectedTabBarItemIndex withObject:previousSelectedDotView]; @@ -414,7 +414,7 @@ - (void)prepareTabBarViewForInitialState { YALTabBarItem *defaultSelectedTabBarItem = [self.allBarItems objectAtIndex:index]; [self configureExtraTabBarItemWithModel:defaultSelectedTabBarItem]; if (self.state == YALTabBarStateCollapsed) { - + if (defaultSelectedTabBarItem.leftImage) { self.extraLeftButton.center = CGPointMake(self.offsetForExtraTabBarItems + CGRectGetWidth(self.extraLeftButton.frame) / 2.f, self.extraLeftButton.center.y); @@ -425,7 +425,7 @@ - (void)prepareTabBarViewForInitialState { } } } - + - (void)configureExtraTabBarItemWithModel:(YALTabBarItem *)item { if (item.leftImage) { self.extraLeftButton.hidden = NO; @@ -447,13 +447,13 @@ - (void)configureExtraTabBarItemWithModel:(YALTabBarItem *)item { self.extraRightButton.hidden = YES; } } - + - (BOOL)hasTabBarItems { return (self.allBarItems.count); } - + #pragma mark - Actions - + - (void)centerButtonPressed { //we should wait until animation cycle is finished @@ -477,14 +477,14 @@ - (void)centerButtonPressed { } } } - + - (void)didTapBarItem:(id)sender { NSUInteger index = [self.allAdditionalButtons indexOfObject:sender]; if (![self.delegate tabBar:self shouldSelectItemAtIndex:index] || [self isAnimating]) { return; } - + if (self.selectedTabBarItemIndex != index) { YALTabBarItem *item = [self.allBarItems objectAtIndex:index]; [self configureExtraTabBarItemWithModel:item]; @@ -499,28 +499,28 @@ - (void)didTapBarItem:(id)sender { if ([self.delegate respondsToSelector:@selector(tabBarWillCollapse:)]) { [self.delegate tabBarWillCollapse:self]; } - + self.state = YALTabBarStateCollapsed; if ([self.delegate respondsToSelector:@selector(tabBar:didSelectItemAtIndex:)]) { [self.delegate tabBar:self didSelectItemAtIndex:index]; } } - + - (void)didPressExtraLeftButton:(id)sender { if ([self.delegate respondsToSelector:@selector(tabBarDidSelectExtraLeftItem:)]) { [self.delegate tabBarDidSelectExtraLeftItem:self]; } } - + - (void)didPressExtraRightButton:(id)sender { if ([self.delegate respondsToSelector:@selector(tabBarDidSelectExtraRightItem:)]) { [self.delegate tabBarDidSelectExtraRightItem:self]; } } - + #pragma mark - expand/collapse - + - (void)expand { self.isFinishedCenterButtonAnimation = NO; self.animatingState = YALAnimatingStateExpanding; @@ -548,7 +548,7 @@ - (void)expand { } }]; } - + - (void)collapse { self.isFinishedCenterButtonAnimation = NO; self.animatingState = YALAnimatingStateCollapsing; @@ -576,44 +576,49 @@ - (void)collapse { [self setAnimating:NO]; }]; } - + - (void)hideSelectedDotView { UIView *previousSelectedDotView = self.allAdditionalButtonsBottomView[self.selectedTabBarItemIndex]; previousSelectedDotView.hidden = YES; [self.allAdditionalButtonsBottomView replaceObjectAtIndex:self.selectedTabBarItemIndex withObject:previousSelectedDotView]; } - + - (void)showSelectedDotView { UIView *previousSelectedDotView = self.allAdditionalButtonsBottomView[self.selectedTabBarItemIndex]; previousSelectedDotView.hidden = NO; [previousSelectedDotView.layer addAnimation:[CAAnimation showSelectedDotAnimation] forKey:nil]; [self.allAdditionalButtonsBottomView replaceObjectAtIndex:self.selectedTabBarItemIndex withObject:previousSelectedDotView]; } - + #pragma mark - Animations - + - (void)animateAdditionalButtons { for (UIView *button in self.allAdditionalButtons) { if (button.hidden) { - [button.layer addAnimation:[CAAnimation animationForAdditionalButton] forKey:nil]; + [button.layer removeAnimationForKey:YALAdditionalButtonsAnimation]; + [button.layer addAnimation:[CAAnimation animationForAdditionalButton] forKey:YALAdditionalButtonsAnimation]; } button.hidden = !button.hidden; } } - + - (void)animateTabBarViewExpand { + [self.mainView.layer removeAnimationForKey:YALTabBarExpandCollapseAnimation]; + CAAnimation *animation = [CAAnimation animationForTabBarExpandFromRect:self.collapsedBounds toRect:self.expandedBounds]; animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; - [self.mainView.layer.mask addAnimation:animation forKey:nil]; + [self.mainView.layer.mask addAnimation:animation forKey:YALTabBarExpandAnimation]; } - + - (void)animateTabBarViewCollapse { + [self.mainView.layer removeAnimationForKey:YALTabBarExpandAnimation]; + CAAnimation *animation = [CAAnimation animationForTabBarCollapseFromRect:self.expandedBounds toRect:self.collapsedBounds]; animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; - [self.mainView.layer.mask addAnimation:animation forKey:nil]; + [self.mainView.layer.mask addAnimation:animation forKey:YALTabBarExpandCollapseAnimation]; } - + - (void)showExtraLeftTabBarItem { [UIView animateWithDuration:kYALShowExtraTabBarItemViewAnimationParameters.duration delay:kYALShowExtraTabBarItemViewAnimationParameters.delay @@ -621,13 +626,13 @@ - (void)showExtraLeftTabBarItem { initialSpringVelocity:kYALShowExtraTabBarItemViewAnimationParameters.velocity options:kYALShowExtraTabBarItemViewAnimationParameters.options animations:^{ - self.extraLeftButton.center = CGPointMake(CGRectGetWidth(self.extraLeftButton.frame) / 2.f + self.offsetForExtraTabBarItems, self.extraLeftButton.center.y); - } completion:NULL]; + self.extraLeftButton.center = CGPointMake(CGRectGetWidth(self.extraLeftButton.frame) / 2.f + self.offsetForExtraTabBarItems, self.extraLeftButton.center.y); + } completion:NULL]; CAAnimation *animation = [CAAnimation animationForExtraLeftBarItem]; - [self.extraLeftButton.layer addAnimation:animation forKey:nil]; + [self.extraLeftButton.layer addAnimation:animation forKey:YALExtraLeftBarItemAnimation]; } - + - (void)showExtraRightTabBarItem { [UIView animateWithDuration:kYALShowExtraTabBarItemViewAnimationParameters.duration delay:kYALShowExtraTabBarItemViewAnimationParameters.delay @@ -635,46 +640,54 @@ - (void)showExtraRightTabBarItem { initialSpringVelocity:kYALShowExtraTabBarItemViewAnimationParameters.velocity options:kYALShowExtraTabBarItemViewAnimationParameters.options animations:^{ - self.extraRightButton.center = CGPointMake(CGRectGetWidth(self.frame) - CGRectGetWidth(self.extraRightButton.frame) / 2.f - self.offsetForExtraTabBarItems, self.extraRightButton.center.y); - } completion:NULL]; + self.extraRightButton.center = CGPointMake(CGRectGetWidth(self.frame) - CGRectGetWidth(self.extraRightButton.frame) / 2.f - self.offsetForExtraTabBarItems, self.extraRightButton.center.y); + } completion:NULL]; CAAnimation *animation = [CAAnimation animationForExtraRightBarItem]; - [self.extraRightButton.layer addAnimation:animation forKey:nil]; + [self.extraRightButton.layer addAnimation:animation forKey:YALExtraRightBarItemAnimation]; } - + - (void)hideExtraLeftTabBarItem { + [self.extraLeftButton.layer removeAnimationForKey:YALExtraLeftBarItemAnimation]; + [UIView animateWithDuration:kYALHideExtraTabBarItemViewAnimationParameters.duration animations:^{ self.extraLeftButton.center = CGPointMake( - CGRectGetWidth(self.extraLeftButton.frame) / 2.f, self.extraLeftButton.center.y); }]; } - + - (void)hideExtraRightTabBarItem { + [self.extraRightButton.layer removeAnimationForKey:YALExtraRightBarItemAnimation]; + [UIView animateWithDuration:kYALHideExtraTabBarItemViewAnimationParameters.duration animations:^{ self.extraRightButton.center = CGPointMake(self.extraRightButton.center.x + CGRectGetWidth(self.extraRightButton.frame) + self.offsetForExtraTabBarItems, self.extraRightButton.center.y); }]; } - + - (void)animateCenterButtonExpand { + [self.centerButton.layer removeAnimationForKey:YALCenterButtonCollapseAnimation]; + CAAnimation *animation = [CAAnimation animationForCenterButtonExpand]; - [self.centerButton.layer addAnimation:animation forKey:nil]; + [self.centerButton.layer addAnimation:animation forKey:YALCenterButtonExpandAnimation]; } - + - (void)animateCenterButtonCollapse { + [self.centerButton.layer removeAnimationForKey:YALCenterButtonExpandAnimation]; + CAAnimation *animation = [CAAnimation animationForCenterButtonCollapse]; - [self.centerButton.layer addAnimation:animation forKey:nil]; + [self.centerButton.layer addAnimation:animation forKey: YALCenterButtonCollapseAnimation]; } - + #pragma mark - Mutators - + - (void)setTabBarColor:(UIColor *)tabBarColor { _tabBarColor = tabBarColor; self.mainView.backgroundColor = self.tabBarColor; self.extraLeftButton.backgroundColor = self.tabBarColor; self.extraRightButton.backgroundColor = self.tabBarColor; } - + - (void)setCollapsedFrame:(CGRect)collapsedFrame { _collapsedFrame = collapsedFrame; @@ -686,7 +699,7 @@ - (void)setCollapsedFrame:(CGRect)collapsedFrame { }); [self updateMaskLayer]; } - + - (void)setExpandedFrame:(CGRect)expandedFrame { _expandedFrame = expandedFrame; @@ -697,9 +710,9 @@ - (void)setExpandedFrame:(CGRect)expandedFrame { }); [self updateMaskLayer]; } - + #pragma mark - Private - + - (void)updateMaskLayer { self.mainView.layer.mask = ({ CAShapeLayer *layer = [CAShapeLayer new]; @@ -710,12 +723,12 @@ - (void)updateMaskLayer { layer; }); } - -// will "activate" touches behind tabBar or better between tabBarItems + + // will "activate" touches behind tabBar or better between tabBarItems -(id)hitTest:(CGPoint)point withEvent:(UIEvent *)event { id hitView = [super hitTest:point withEvent:event]; if (hitView == self.mainView) return nil; else return hitView; } - -@end + + @end From 2847efb49755b59b6930646b5517476519bf040f Mon Sep 17 00:00:00 2001 From: Anton Vodolazkyi Date: Tue, 18 Apr 2017 14:34:00 +0300 Subject: [PATCH 2/2] improvements --- FoldingTabBar/Constants/YALAnimatingTabBarConstants.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FoldingTabBar/Constants/YALAnimatingTabBarConstants.m b/FoldingTabBar/Constants/YALAnimatingTabBarConstants.m index b020eaa..9f30d5e 100644 --- a/FoldingTabBar/Constants/YALAnimatingTabBarConstants.m +++ b/FoldingTabBar/Constants/YALAnimatingTabBarConstants.m @@ -9,8 +9,8 @@ CGFloat const YALForExtraTabBarItemsDefaultOffset = 15.f; UIEdgeInsets const YALTabBarViewHDefaultEdgeInsets = {10.f, 14.f, 10.f, 14.f}; UIEdgeInsets const YALTabBarViewItemsDefaultEdgeInsets = {0.f, 0.f, 0.f, 0.f}; -NSString * const YALCenterButtonExpandAnimation = @"CENTER_BUTOON_EXPAND_ANIMATION"; -NSString * const YALCenterButtonCollapseAnimation = @"CENTER_BUTOON_COLLAPSE_ANIMATION"; +NSString * const YALCenterButtonExpandAnimation = @"CENTER_BUTTON_EXPAND_ANIMATION"; +NSString * const YALCenterButtonCollapseAnimation = @"CENTER_BUTTON_COLLAPSE_ANIMATION"; NSString * const YALAdditionalButtonsAnimation = @"ADDITIONAL_BUTTONS_ANIMATION"; NSString * const YALTabBarExpandAnimation = @"TABBAR_EXPAND_ANIMATION"; NSString * const YALTabBarExpandCollapseAnimation = @"TABBAR_COLLAPSE_ANIMATION";