NatwarAnil
NatwarAnil

Reputation: 31

How to give ripple effect on touch on a view in ipad application

I want to use ripple effect on a specific area of view when the touch event happens. I used the following code:

CATransition *animation=[CATransition animation];
    [animation setDelegate:self];
    [animation setDuration:1.75];
    [animation setTimingFunction:UIViewAnimationCurveEaseInOut];
    [animation setType:@"rippleEffect"];

    [animation setFillMode:kCAFillModeRemoved];
    animation.endProgress=0.99;        

    [animation setRemovedOnCompletion:NO];
    [self.view.layer addAnimation:animation forKey:nil];

But this one give effect on whole,but I want the effect on a fixed area where touch event happens. How to do that???Kindly help

Thanks.

Upvotes: 2

Views: 2135

Answers (1)

Antonio MG
Antonio MG

Reputation: 20410

Why dont you detect where the touch is, put a transparent UIView on top of it for example 20 pixels around the touch, an add the animation to that only view?

If you need the code I can write to you.

Upvotes: 1

Related Questions