victorBaro / VBFPopFlatButton

Flat button with 9 different states using POP
MIT License
3.09k stars 294 forks source link

Animation stops working #7

Closed evliu closed 10 years ago

evliu commented 10 years ago

Hi, here's my scenario:

I have [self.button animateToType:buttonCloseType] fire when the button is tapped, coming from buttonMenuType, which opens up an RNFrostedSidebar.

When the sidebar is dismissed, it fires it's own delegate method didDismissFromScreen, and in there, i have [self.button animateToType:buttonMenuType], which fires fine.

After that, when I tap the button again, the RNFrostedSidebar opens up, but I no longer get any animations, but the self.button.currentButtonType shows the correct button type both before and after firing animateToType even though the animation doesn't fire. Any thoughts?

evliu commented 10 years ago

I've seemed to hacky-fix it doing:

    double delayInSeconds = 0.1;
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
        [self.button animateToType:buttonCloseType];
    });
victorBaro commented 10 years ago

Thanks for sharing your hacky-fix ;)