manuelescrig / MEVFloatingButton

An iOS drop-in UITableView, UICollectionView and UIScrollView superclass category for showing a customizable floating button on top of it.
MIT License
297 stars 39 forks source link

Rotate MEVFloatingButton #9

Closed riyanpratamap closed 7 years ago

riyanpratamap commented 7 years ago

Hi,

I want to give rotation animation into MEVFloatingButton. So I tried with this,

- (void)floatingButton:(UIScrollView *)scrollView didTapButton:(UIButton *)button {
    [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
        [self.button setTransform:CGAffineTransformRotate(self.button.transform, M_PI)];
    }completion:^(BOOL finished){
        NSLog(@"completed animating");
    }];
}

On a standard UIButton, it will rotate its button with button's center. But with MEVFloatingButton, it rotated like a mars with sun as it center. I mean, MEVFloatingButton is the mars.

Is there any solution? Thank you!

riyanpratamap commented 7 years ago

I succeed rotate MEVFloatingButton by accessing its button from param

- (void)floatingButton:(UIScrollView *)scrollView didTapButton:(UIButton *)button {
    [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
        [button setTransform:CGAffineTransformRotate(button.transform, M_PI)];
    }completion:^(BOOL finished){
        NSLog(@"completed animating");
    }];
}

Thank you, this is a great library!