rahul rahul - 1 year ago 156
iOS Question

how to implement instagram similar like effect in ios?

I am developing a social app in which I want to implement like functionality similar to instagram, there are feeds with images similar to instagram when user double taps any image then it should show a heart icon with animation similar to instagram. I tried to do the same thing but unable to achieve the animation, can anybody tell me how can I do that.
I am attaching the image of instagram like functionality.enter image description here

Answer Source

Here is an implementation:

- (void) animateLike {
    [UIView animateWithDuration:0.3f delay:0 options:UIViewAnimationOptionAllowUserInteraction animations:^{
        heartPopup.transform = CGAffineTransformMakeScale(1.3, 1.3);
        heartPopup.alpha = 1.0;
    } completion:^(BOOL finished) {
        [UIView animateWithDuration:0.1f delay:0 options:UIViewAnimationOptionAllowUserInteraction animations:^{
            heartPopup.transform = CGAffineTransformMakeScale(1.0, 1.0);
        } completion:^(BOOL finished) {
            [UIView animateWithDuration:0.3f delay:0 options:UIViewAnimationOptionAllowUserInteraction animations:^{
                heartPopup.transform = CGAffineTransformMakeScale(1.3, 1.3);
                heartPopup.alpha = 0.0;
            } completion:^(BOOL finished) {
                heartPopup.transform = CGAffineTransformMakeScale(1.0, 1.0);
            }];
        }];
    }];
}

heartPopup is a UIImageView, set it up in the interface builder in the center of the image and set alpha to zero on it. Call the above method to animate the like effect.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download