Skip to content

Commit

Permalink
Fixed bug when 'plus' button doesn't change state after programmatica…
Browse files Browse the repository at this point in the history
…lly show/hide buttons
  • Loading branch information
Friend-LGA committed Jul 26, 2015
1 parent efd972d commit b414945
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions LGPlusButtonsView/LGPlusButtonsView.m
Original file line number Diff line number Diff line change
Expand Up @@ -877,18 +877,10 @@ - (void)updatePosition

- (void)plusButtonAction:(LGPlusButton *)button
{
_plusButton.selected = !_plusButton.isSelected;

if (_plusButton.isSelected)
{
[self selectPlusButtonViewWithAnimationType:_plusButtonAnimationType animated:YES completionHandler:nil];
[self showButtonsAnimated:YES completionHandler:nil];
}
else
{
[self deselectPlusButtonViewWithAnimationType:_plusButtonAnimationType animated:YES completionHandler:nil];
[self hideButtonsAnimated:YES completionHandler:nil];
}
else
[self showButtonsAnimated:YES completionHandler:nil];

if (_plusButtonActionHandler) _plusButtonActionHandler(self);

Expand Down Expand Up @@ -1026,6 +1018,10 @@ - (void)showButtonsAnimated:(BOOL)animated completionHandler:(void(^)())completi
{
if (self.isShowsPlusButton)
{
_plusButton.selected = YES;

[self selectPlusButtonViewWithAnimationType:_plusButtonAnimationType animated:YES completionHandler:nil];

NSTimeInterval delay = 0.03;

for (NSInteger i=1; i<_buttons.count; i++)
Expand Down Expand Up @@ -1067,6 +1063,10 @@ - (void)hideButtonsAnimated:(BOOL)animated completionHandler:(void(^)())completi
{
if (self.isShowsPlusButton)
{
_plusButton.selected = NO;

[self deselectPlusButtonViewWithAnimationType:_plusButtonAnimationType animated:YES completionHandler:nil];

NSTimeInterval delay = 0.03;

for (NSInteger i=1; i<_buttons.count; i++)
Expand Down Expand Up @@ -1299,7 +1299,8 @@ - (void)selectPlusButtonViewWithAnimationType:(LGPlusButtonAnimationType)type an
[UIView transitionWithView:plusButtonWrapperView2
duration:0.2
options:UIViewAnimationOptionTransitionCrossDissolve
animations:nil completion:completionHandler];
animations:nil
completion:completionHandler];
}
else if (type == LGPlusButtonAnimationTypeRotate)
{
Expand Down Expand Up @@ -1335,7 +1336,8 @@ - (void)deselectPlusButtonViewWithAnimationType:(LGPlusButtonAnimationType)type
[UIView transitionWithView:plusButtonWrapperView2
duration:0.2
options:UIViewAnimationOptionTransitionCrossDissolve
animations:nil completion:completionHandler];
animations:nil
completion:completionHandler];
}
else if (type == LGPlusButtonAnimationTypeRotate)
{
Expand Down

0 comments on commit b414945

Please sign in to comment.