IFTTT/JazzHands

UIButton does not work

Closed this issue · 4 comments

Trying to animate a UIButton does not work. UILabel animated fine, and if I put the UIButton inside a UIView and animate the UIView, everything works.

We have a number of animated UIButton views in the IFTTT app intro using Jazz Hands. Maybe you can share some of your code?

The first one works (UIImageView subclass) and the second one (UIButton) does not.

    IFTTTFrameAnimation *fbImageFrameAnimation = [IFTTTFrameAnimation animationWithView:self.signedin.profilePictureView];
    [self.animator addAnimation:fbImageFrameAnimation];
    [fbImageFrameAnimation addKeyFrames:@[
                                                [IFTTTAnimationKeyFrame keyFrameWithTime:timeForPage(6) andFrame:CGRectOffset(self.signedin.profilePictureView.frame, -320, -300)],
                                                [IFTTTAnimationKeyFrame keyFrameWithTime:timeForPage(7) andFrame:self.signedin.profilePictureView.frame]
                                                ]];

    IFTTTFrameAnimation *startImageFrameAnimation = [IFTTTFrameAnimation animationWithView:self.signedin.startButton];
    [self.animator addAnimation:startImageFrameAnimation];
    [startImageFrameAnimation addKeyFrames:@[
                                                [IFTTTAnimationKeyFrame keyFrameWithTime:timeForPage(6) andFrame:CGRectOffset(self.signedin.startButton.frame, -320, 300)],
                                                [IFTTTAnimationKeyFrame keyFrameWithTime:timeForPage(7) andFrame:self.signedin.startButton.frame]
                                                ]];

I've also got a scenario where I've added a UITapGestureRecognizer and a UIButton, neither of which are tappable. The UIButton was added to the storyboard with no keyframe animations. The UITapGestureRecognizer was added to a UIView from the storyboard, and the UIView has some animations.

Something like this:

    CGRect frame = self.wrapperView.frame;
    frame = 200;
    frame = 0;
    [wrapperAnimation addKeyFrame:[[IFTTTAnimationKeyFrame alloc] initWithTime:timeForPage(1) andFrame:frame]];
    frame.origin.x = 100;
    [wrapperAnimation addKeyFrame:[[IFTTTAnimationKeyFrame alloc] initWithTime:timeForPage(2) andFrame:frame]];
    frame.origin.x = 40;
    [wrapperAnimation addKeyFrame:[[IFTTTAnimationKeyFrame alloc] initWithTime:timeForPage(3) andFrame:frame]];

'''

Again, neither tap controls are responding.

The trick for me was to add the view which was created in the storyboard to my scrollview. Got it.